[sailfish] show the last updated datetimestamp for feeds if the api supports it, closes #149
This commit is contained in:
parent
71739c0cfc
commit
89036d6b1c
4 changed files with 83 additions and 18 deletions
|
|
@ -237,22 +237,22 @@
|
|||
<context>
|
||||
<name>FeedDelegate</name>
|
||||
<message>
|
||||
<location filename="../qml/ttrss/sailfish/pages/FeedDelegate.qml" line="114"/>
|
||||
<location filename="../qml/ttrss/sailfish/pages/FeedDelegate.qml" line="113"/>
|
||||
<source>Marking all read</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/ttrss/sailfish/pages/FeedDelegate.qml" line="122"/>
|
||||
<location filename="../qml/ttrss/sailfish/pages/FeedDelegate.qml" line="121"/>
|
||||
<source>Unsubcribing</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/ttrss/sailfish/pages/FeedDelegate.qml" line="96"/>
|
||||
<location filename="../qml/ttrss/sailfish/pages/FeedDelegate.qml" line="95"/>
|
||||
<source>Mark all read</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/ttrss/sailfish/pages/FeedDelegate.qml" line="100"/>
|
||||
<location filename="../qml/ttrss/sailfish/pages/FeedDelegate.qml" line="99"/>
|
||||
<source>Unsubscribe</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
@ -260,15 +260,15 @@
|
|||
<context>
|
||||
<name>FeedItem</name>
|
||||
<message>
|
||||
<location filename="../qml/ttrss/harmattan/FeedItem.qml" line="92"/>
|
||||
<location filename="../qml/ttrss/harmattan/FeedItem.qml" line="280"/>
|
||||
<location filename="../qml/ttrss/harmattan/FeedItem.qml" line="283"/>
|
||||
<location filename="../qml/ttrss/harmattan/FeedItem.qml" line="93"/>
|
||||
<location filename="../qml/ttrss/harmattan/FeedItem.qml" line="313"/>
|
||||
<location filename="../qml/ttrss/harmattan/FeedItem.qml" line="316"/>
|
||||
<location filename="../qml/ttrss/sailfish/pages/FeedItem.qml" line="56"/>
|
||||
<source>Open in Web Browser</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/ttrss/harmattan/FeedItem.qml" line="289"/>
|
||||
<location filename="../qml/ttrss/harmattan/FeedItem.qml" line="322"/>
|
||||
<source>Share</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
@ -283,16 +283,19 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/ttrss/harmattan/FeedItem.qml" line="327"/>
|
||||
<location filename="../qml/ttrss/sailfish/pages/FeedItem.qml" line="68"/>
|
||||
<source>Edit Note</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/ttrss/harmattan/FeedItem.qml" line="336"/>
|
||||
<location filename="../qml/ttrss/sailfish/pages/FeedItem.qml" line="80"/>
|
||||
<source>Assign Labels</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/ttrss/harmattan/FeedItem.qml" line="103"/>
|
||||
<location filename="../qml/ttrss/sailfish/pages/FeedItem.qml" line="173"/>
|
||||
<source>Note: %1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
|
@ -371,19 +374,19 @@
|
|||
</message>
|
||||
<message>
|
||||
<location filename="../qml/ttrss/harmattan/FeedItems.qml" line="101"/>
|
||||
<location filename="../qml/ttrss/sailfish/pages/FeedItems.qml" line="143"/>
|
||||
<location filename="../qml/ttrss/sailfish/pages/FeedItems.qml" line="149"/>
|
||||
<source>Loading</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/ttrss/harmattan/FeedItems.qml" line="102"/>
|
||||
<location filename="../qml/ttrss/sailfish/pages/FeedItems.qml" line="144"/>
|
||||
<location filename="../qml/ttrss/sailfish/pages/FeedItems.qml" line="150"/>
|
||||
<source>No items in feed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/ttrss/harmattan/FeedItems.qml" line="102"/>
|
||||
<location filename="../qml/ttrss/sailfish/pages/FeedItems.qml" line="144"/>
|
||||
<location filename="../qml/ttrss/sailfish/pages/FeedItems.qml" line="150"/>
|
||||
<source>No unread items in feed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
@ -445,11 +448,29 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/ttrss/sailfish/pages/FeedItems.qml" line="173"/>
|
||||
<location filename="../qml/ttrss/sailfish/pages/FeedItems.qml" line="140"/>
|
||||
<source>Last updated: %1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/ttrss/sailfish/pages/FeedItems.qml" line="179"/>
|
||||
<source>Marking all loaded as read</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>FeedModel</name>
|
||||
<message>
|
||||
<location filename="../qml/ttrss/models/FeedModel.qml" line="87"/>
|
||||
<source>Less than an hour ago</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/ttrss/models/FeedModel.qml" line="90"/>
|
||||
<source>Today</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Feeds</name>
|
||||
<message>
|
||||
|
|
@ -555,16 +576,19 @@
|
|||
<context>
|
||||
<name>LabelUpdater</name>
|
||||
<message>
|
||||
<location filename="../qml/ttrss/harmattan/LabelUpdater.qml" line="39"/>
|
||||
<location filename="../qml/ttrss/sailfish/pages/LabelUpdater.qml" line="49"/>
|
||||
<source>Update Labels</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/ttrss/harmattan/LabelUpdater.qml" line="105"/>
|
||||
<location filename="../qml/ttrss/sailfish/pages/LabelUpdater.qml" line="112"/>
|
||||
<source>Loading</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/ttrss/harmattan/LabelUpdater.qml" line="106"/>
|
||||
<location filename="../qml/ttrss/sailfish/pages/LabelUpdater.qml" line="113"/>
|
||||
<source>You have no label defined. You can create them in the webview.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
|
@ -645,6 +669,16 @@
|
|||
<source>Restore</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/ttrss/sailfish/pages/MainPage.qml" line="219"/>
|
||||
<source>The API is disabled. You have to enable it in the webinterface.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/ttrss/sailfish/pages/MainPage.qml" line="222"/>
|
||||
<source>The supplied login credentials did not work.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>NoteEditor</name>
|
||||
|
|
@ -654,16 +688,19 @@
|
|||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/ttrss/harmattan/NoteEditor.qml" line="46"/>
|
||||
<location filename="../qml/ttrss/sailfish/pages/NoteEditor.qml" line="56"/>
|
||||
<source>Edit Note</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/ttrss/harmattan/NoteEditor.qml" line="30"/>
|
||||
<location filename="../qml/ttrss/sailfish/pages/NoteEditor.qml" line="57"/>
|
||||
<source>Save Note</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/ttrss/harmattan/NoteEditor.qml" line="31"/>
|
||||
<location filename="../qml/ttrss/sailfish/pages/NoteEditor.qml" line="58"/>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
|
|
|||
|
|
@ -51,15 +51,15 @@ ListModel {
|
|||
|
||||
/** @private */
|
||||
function load() {
|
||||
var ttrss = rootWindow.getTTRSS();
|
||||
var feeditems = ttrss.getFeedItems(feed.feedId);
|
||||
var ttrss = rootWindow.getTTRSS()
|
||||
var feeditems = ttrss.getFeedItems(feed.feedId)
|
||||
|
||||
var showAll = ttrss.getShowAll();
|
||||
settings.showAll = showAll;
|
||||
var showAll = ttrss.getShowAll()
|
||||
settings.showAll = showAll
|
||||
|
||||
//root.clear(); clearing is done by caller instead, so this is more like an 'append' and can be used by loadMore aswell
|
||||
|
||||
var now = new Date();
|
||||
var now = new Date()
|
||||
|
||||
if (feeditems && feeditems.length) {
|
||||
root.continuation += feeditems.length
|
||||
|
|
|
|||
|
|
@ -56,6 +56,12 @@ ListModel {
|
|||
//First add feed with unread items
|
||||
var totalUnreadCount = 0
|
||||
|
||||
var now = new Date()
|
||||
var secsUnix = now.getTime() / 1000
|
||||
var lessThanAnHourAgo = secsUnix - 3600
|
||||
var today = new Date(now.getFullYear(), now.getMonth(), now.getDate())
|
||||
var todayUnix = today.getTime() / 1000
|
||||
|
||||
for(var feed = 0; feed < feeds.length; feed++) {
|
||||
if (feeds[feed]) {
|
||||
var title = ttrss.html_entity_decode(feeds[feed].title, 'ENT_QUOTES')
|
||||
|
|
@ -74,6 +80,21 @@ ListModel {
|
|||
title = constant.recentlyArticles
|
||||
}
|
||||
|
||||
var formatedDate = ''
|
||||
if (feeds[feed].last_updated !== undefined) {
|
||||
var lastUpdated = feeds[feed].last_updated
|
||||
if (lastUpdated > lessThanAnHourAgo) {
|
||||
formatedDate = qsTr('Less than an hour ago')
|
||||
}
|
||||
else if (lastUpdated > todayUnix) {
|
||||
formatedDate = qsTr('Today')
|
||||
}
|
||||
else {
|
||||
var d = new Date(feeds[feed].last_updated * 1000)
|
||||
formatedDate = Qt.formatDate(d, Qt.DefaultLocaleShortDate)
|
||||
}
|
||||
}
|
||||
|
||||
// Note: cat_id is infact the id the feed originally was in,
|
||||
// not the special id of All Feeds or similar
|
||||
root.append({
|
||||
|
|
@ -83,6 +104,7 @@ ListModel {
|
|||
categoryId: parseInt(feeds[feed].cat_id),
|
||||
isCat: false,
|
||||
icon: settings.displayIcons ? ttrss.getIconUrl(feeds[feed].id) : ''
|
||||
lastUpdated: formatedDate
|
||||
})
|
||||
totalUnreadCount += parseInt(feeds[feed].unread)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ Page {
|
|||
|
||||
header: Column {
|
||||
width: listView.width
|
||||
height: header.height + info.height
|
||||
height: header.height + info.height + lastUpdated.height
|
||||
PageHeader {
|
||||
id: header
|
||||
title: feed.title
|
||||
|
|
@ -135,6 +135,12 @@ Page {
|
|||
width: parent.width
|
||||
onClicked: feedItemModel.update()
|
||||
}
|
||||
SectionHeader {
|
||||
id: lastUpdated
|
||||
text: feed.lastUpdated !== "" ? qsTr("Last updated: %1").arg(feed.lastUpdated) : ""
|
||||
visible: text !== ""
|
||||
height: Theme.itemSizeExtraSmall
|
||||
}
|
||||
}
|
||||
|
||||
ViewPlaceholder {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue