bugfixes
This commit is contained in:
parent
504c7b5be5
commit
49875713dc
3 changed files with 41 additions and 62 deletions
|
|
@ -78,7 +78,7 @@ Page {
|
|||
source: "image://theme/icon-m-common-drilldown-arrow" + (theme.inverted ? "-inverse" : "")
|
||||
anchors.right: parent.right;
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: model.categoryId !== null
|
||||
visible: model.categoryId != null
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
|
|
@ -95,7 +95,7 @@ Page {
|
|||
}
|
||||
|
||||
function showCategory(catId, title) {
|
||||
if(catId !== null) {
|
||||
if(catId != null) {
|
||||
console.log("Loading feeds for category "+catId+"\n");
|
||||
var component = Qt.createComponent("Feeds.qml");
|
||||
if (component.status === Component.Ready)
|
||||
|
|
@ -128,7 +128,7 @@ Page {
|
|||
someCategories = true;
|
||||
|
||||
if(categories[category].unread > 0) {
|
||||
if (category >= 0)
|
||||
if (categories[category].id >= 0)
|
||||
totalUnreadCount += categories[category].unread;
|
||||
|
||||
categoriesModel.append({
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@ Page {
|
|||
font.weight: Font.Bold
|
||||
font.pixelSize: constant.fontSizeLarge
|
||||
color: (model.unreadcount > 0) ? constant.colorListItemActive : constant.colorListItemDisabled;
|
||||
|
||||
}
|
||||
|
||||
Label {
|
||||
|
|
@ -79,14 +78,14 @@ Page {
|
|||
source: "image://theme/icon-m-common-drilldown-arrow" + (theme.inverted ? "-inverse" : "")
|
||||
anchors.right: parent.right;
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: (model.feedId !== null)
|
||||
visible: (model.feedId != null)
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
anchors.fill: background
|
||||
onClicked: {
|
||||
showFeed(model.feedId);
|
||||
showFeed(model.feedId, model.title);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -110,58 +109,28 @@ Page {
|
|||
|
||||
loading = false;
|
||||
|
||||
if(feeds) {
|
||||
var emptyList = feeds.length;
|
||||
var unreadcount;
|
||||
console.log("showing feeds for category: "+categoryId+"\n");
|
||||
|
||||
if(!ttrss.isEmpty(feeds)) {
|
||||
//First add feed with unread items
|
||||
for(var feed in feeds) {
|
||||
unreadcount = feeds[feed].unread;
|
||||
if( unreadcount && (unreadcount > 0)) {
|
||||
emptyList = false;
|
||||
|
||||
if( showAll || feeds[feed].unread > 0) {
|
||||
feedsModel.append({
|
||||
title: ttrss.html_entity_decode(feeds[feed].title, 'ENT_QUOTES'),
|
||||
subtitle: "Unread: " + unreadcount,
|
||||
unreadcount: unreadcount,
|
||||
feedId: feeds[feed].id,
|
||||
});
|
||||
}
|
||||
}
|
||||
//If we're showing all feeds, add the ones with no unread items
|
||||
if(showAll) {
|
||||
for(var feed in feeds) {
|
||||
unreadcount = feeds[feed].unread;
|
||||
if(unreadcount === 0) {
|
||||
feedsModel.append({
|
||||
title: ttrss.html_entity_decode(feeds[feed].title,'ENT_QUOTES'),
|
||||
subtitle: "Unread: " + unreadcount,
|
||||
unreadcount: unreadcount,
|
||||
feedId: feeds[feed].id,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(emptyList) {
|
||||
if(showAll ||(feeds.length === 0) ) {
|
||||
feedsModel.append({
|
||||
title: qsTr("No feeds in category"),
|
||||
subtitle: "",
|
||||
feedId: null,
|
||||
unreadCount: 0,
|
||||
});
|
||||
} else {
|
||||
feedsModel.append({
|
||||
title: qsTr("Category has no unread items"),
|
||||
subtitle: "",
|
||||
feedId: null,
|
||||
unreadCount: 0,
|
||||
title: ttrss.html_entity_decode(feeds[feed].title, 'ENT_QUOTES'),
|
||||
subtitle: (feeds[feed].unread > 0 ? qsTr("Unread: ") + feeds[feed].unread : ""),
|
||||
unreadcount: feeds[feed].unread,
|
||||
feedId: feeds[feed].id,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
var t = (showAll ? qsTr("No feeds in category") : qsTr("Category has no unread items"))
|
||||
feedsModel.append({
|
||||
title: t,
|
||||
subtitle: "",
|
||||
unreadcount: 0,
|
||||
feedId: null,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
onCategoryIdChanged: {
|
||||
|
|
@ -183,12 +152,12 @@ Page {
|
|||
}
|
||||
}
|
||||
|
||||
function showFeed(feedId) {
|
||||
if(feedId !== null) {
|
||||
function showFeed(feedId, title) {
|
||||
if(feedId != null) {
|
||||
console.log("Loading items for "+feedId+"\n");
|
||||
var component = Qt.createComponent("ItemList.qml");
|
||||
var component = Qt.createComponent("FeedItems.qml");
|
||||
if (component.status === Component.Ready)
|
||||
pageStack.push(component, { feedId: feedId });
|
||||
pageStack.push(component, { feedId: feedId, pageTitle: title });
|
||||
else
|
||||
console.log("Error loading component:", component.errorString());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,9 +25,10 @@ var state={
|
|||
'closeIfEmpty': false, //Should pages close if they have no content to display
|
||||
'tracelevel': 2, //1 = errors, 2 = key info, 3 = network traffic, 4 info, 5 high detail
|
||||
|
||||
'categories': {},
|
||||
'feeds': {},
|
||||
'lastcategoryid': null,
|
||||
'categories': {},
|
||||
'feeds': {},
|
||||
'feeditems': {},
|
||||
'lastcategory': { 'id': null },
|
||||
};
|
||||
|
||||
var requestsPending={
|
||||
|
|
@ -52,6 +53,15 @@ var initial_state = JSON.parse(JSON.stringify(state));
|
|||
var initial_requestsPending = JSON.parse(JSON.stringify(requestsPending));
|
||||
var initial_responsesPending = JSON.parse(JSON.stringify(responsesPending));
|
||||
|
||||
function isEmpty(obj) {
|
||||
for(var prop in obj) {
|
||||
if(obj.hasOwnProperty(prop))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function trace(level, text) {
|
||||
if(level <= state['tracelevel'])
|
||||
console.log(text+'\n');
|
||||
|
|
@ -159,7 +169,7 @@ function updateCategories(callback) {
|
|||
var params = {
|
||||
'op': 'getCategories',
|
||||
'sid': state['token'],
|
||||
'unread_only': state['showAll']
|
||||
'unread_only': !state['showall']
|
||||
}
|
||||
|
||||
var http = new XMLHttpRequest();
|
||||
|
|
@ -220,7 +230,7 @@ function updateFeeds(catId, callback) {
|
|||
// needs to be logged in
|
||||
if(!state['token']) {
|
||||
requestsPending['feeds'] = true;
|
||||
state['lastcategoryid'] = catId;
|
||||
state['lastcategory']['id'] = catId;
|
||||
processPendingRequests(callback);
|
||||
return;
|
||||
}
|
||||
|
|
@ -231,7 +241,7 @@ function updateFeeds(catId, callback) {
|
|||
'op': 'getFeeds',
|
||||
'sid': state['token'],
|
||||
'cat_id': catId,
|
||||
'unread_only': state['showAll']
|
||||
'unread_only': !state['showall']
|
||||
}
|
||||
|
||||
var http = new XMLHttpRequest();
|
||||
|
|
@ -316,7 +326,7 @@ function processPendingRequests(callback) {
|
|||
//Get the auth token
|
||||
login(callback);
|
||||
else
|
||||
updateFeeds(state['lastcategoryid'], callback);
|
||||
updateFeeds(state['lastcategory']['id'], callback);
|
||||
}
|
||||
|
||||
return foundWork;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue