Merge branch 'show-all' of git://github.com/michael-k/ttrss into michael-k-show-all
This commit is contained in:
commit
68041bc074
16 changed files with 40 additions and 71 deletions
|
|
@ -23,37 +23,21 @@ import QtQuick 1.1
|
|||
import com.nokia.meego 1.0
|
||||
|
||||
MenuItem {
|
||||
id: toggleUnread
|
||||
signal updateView
|
||||
|
||||
property bool showAll
|
||||
property bool notInitialAssignment: false
|
||||
signal updateView(bool showAll)
|
||||
text: settings.showAll ? qsTr("Show Unread Only") : qsTr("Show All")
|
||||
|
||||
text: showAll ? qsTr("Show Unread Only") : qsTr("Show All")
|
||||
onClicked: {
|
||||
var newValue = !settings.showAll
|
||||
|
||||
// update backend
|
||||
var ttrss = rootWindow.getTTRSS()
|
||||
ttrss.setShowAll(!showAll)
|
||||
showAll = !showAll
|
||||
ttrss.setShowAll(newValue)
|
||||
|
||||
// update settings
|
||||
settings.showAll = showAll
|
||||
}
|
||||
|
||||
onShowAllChanged: {
|
||||
// send the signal only if this is not the initial assignment
|
||||
if (notInitialAssignment)
|
||||
updateView(showAll)
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
showAll = settings.showAll
|
||||
var ttrss = rootWindow.getTTRSS()
|
||||
ttrss.setShowAll(showAll)
|
||||
notInitialAssignment = true
|
||||
}
|
||||
|
||||
onVisibleChanged: {
|
||||
if (visible && notInitialAssignment) {
|
||||
var ttrss = rootWindow.getTTRSS()
|
||||
showAll = ttrss.getShowAll()
|
||||
}
|
||||
// inform about change
|
||||
updateView()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ Page {
|
|||
EmptyListInfoLabel {
|
||||
text: network.loading ?
|
||||
qsTr("Loading") :
|
||||
rootWindow.showAll ? qsTr("No categories to display") : qsTr("No categories have unread items")
|
||||
settings.showAll ? qsTr("No categories to display") : qsTr("No categories have unread items")
|
||||
anchors.fill: parent
|
||||
visible: categories.count == 0
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ Page {
|
|||
EmptyListInfoLabel {
|
||||
text: network.loading ?
|
||||
qsTr("Loading") :
|
||||
rootWindow.showAll ? qsTr("No items in feed") : qsTr("No unread items in feed")
|
||||
settings.showAll ? qsTr("No items in feed") : qsTr("No unread items in feed")
|
||||
anchors.fill: parent
|
||||
anchors.margins: MyTheme.paddingLarge
|
||||
visible: feedItems.count == 0
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ Page {
|
|||
EmptyListInfoLabel {
|
||||
text: network.loading ?
|
||||
qsTr("Loading") :
|
||||
rootWindow.showAll ? qsTr("No feeds in category") : qsTr("Category has no unread items")
|
||||
settings.showAll ? qsTr("No feeds in category") : qsTr("Category has no unread items")
|
||||
anchors.fill: parent
|
||||
visible: feeds.count == 0
|
||||
}
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ Page {
|
|||
myMenu.close()
|
||||
|
||||
var ttrss = rootWindow.getTTRSS();
|
||||
ttrss.initState();
|
||||
ttrss.initState(settings.showAll);
|
||||
ttrss.setLoginDetails(username.text, password.text, server.text);
|
||||
if (settings.httpauthusername != '' && settings.httpauthpassword != '') {
|
||||
ttrss.setHttpAuthInfo(settings.httpauthusername, settings.httpauthpassword);
|
||||
|
|
|
|||
|
|
@ -45,8 +45,6 @@ PageStackWindow {
|
|||
return TTRss;
|
||||
}
|
||||
|
||||
property bool showAll: false
|
||||
|
||||
Binding {
|
||||
target: theme
|
||||
property: "inverted"
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ ListModel {
|
|||
var ttrss = rootWindow.getTTRSS()
|
||||
|
||||
var showAll = ttrss.getShowAll()
|
||||
rootWindow.showAll = showAll
|
||||
settings.showAll = showAll
|
||||
|
||||
var categories = ttrss.getCategories()
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ ListModel {
|
|||
var feeditems = ttrss.getFeedItems(feed.feedId);
|
||||
|
||||
var showAll = ttrss.getShowAll();
|
||||
rootWindow.showAll = showAll;
|
||||
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
|
||||
|
||||
|
|
@ -173,7 +173,7 @@ ListModel {
|
|||
var item = root.get(i)
|
||||
if (item.unread) {
|
||||
root.setProperty(i, "unread", false)
|
||||
if (!rootWindow.showAll) {
|
||||
if (!settings.showAll) {
|
||||
root.continuation += 1
|
||||
}
|
||||
root.itemUnreadChanged(item)
|
||||
|
|
@ -205,7 +205,7 @@ ListModel {
|
|||
ttrss.updateFeedUnread(item.id, newState, function(successful,
|
||||
errorMessage) {
|
||||
if (successful) {
|
||||
if (!rootWindow.showAll) {
|
||||
if (!settings.showAll) {
|
||||
root.continuation += newState ? +1 : -1
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ ListModel {
|
|||
function load() {
|
||||
var ttrss = rootWindow.getTTRSS()
|
||||
var feeds = ttrss.getFeeds(category.categoryId)
|
||||
rootWindow.showAll = ttrss.getShowAll()
|
||||
settings.showAll = ttrss.getShowAll()
|
||||
root.clear()
|
||||
|
||||
if(feeds && feeds.length) {
|
||||
|
|
|
|||
|
|
@ -62,8 +62,9 @@ var responsesPending = {}
|
|||
/**
|
||||
* Sets the initial values of variables state, requestsPending, and
|
||||
* responsesPending. This deletes any former values.
|
||||
* @param {boolean} Initial value of showAll.
|
||||
*/
|
||||
function initState() {
|
||||
function initState(showAll) {
|
||||
state = {
|
||||
'imageProxy': '',
|
||||
'url': null,
|
||||
|
|
@ -73,7 +74,7 @@ function initState() {
|
|||
'httpauth': { 'dobasicauth' : false },
|
||||
'token': null,
|
||||
'apilevel': 0,
|
||||
'showall': false, // boolean; show all items vs only those unread
|
||||
'showall': false, // see getter/setter for documentation
|
||||
'closeIfEmpty': false, // Should pages close if they have no content to display
|
||||
'tracelevel': 1, // 1 = errors, 2 = key info, 3 = network traffic,
|
||||
// 4 = info, 5 = high detail
|
||||
|
|
@ -108,6 +109,9 @@ function initState() {
|
|||
'feeditemunread': false,
|
||||
'feeditemrss': false,
|
||||
};
|
||||
|
||||
// Set default values given as parameters
|
||||
setShowAll(showAll)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -34,8 +34,6 @@ ApplicationWindow {
|
|||
return TTRss;
|
||||
}
|
||||
|
||||
property bool showAll: false
|
||||
|
||||
Constants {
|
||||
id: constant
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,36 +23,21 @@ import QtQuick 2.0
|
|||
import Sailfish.Silica 1.0
|
||||
|
||||
MenuItem {
|
||||
property bool showAll
|
||||
property bool notInitialAssignment: false
|
||||
signal updateView(bool showAll)
|
||||
signal updateView
|
||||
|
||||
text: settings.showAll ? qsTr("Show Unread Only") : qsTr("Show All")
|
||||
|
||||
text: showAll ? qsTr("Show Unread Only") : qsTr("Show All")
|
||||
onClicked: {
|
||||
var newValue = !settings.showAll
|
||||
|
||||
// update backend
|
||||
var ttrss = rootWindow.getTTRSS()
|
||||
ttrss.setShowAll(!showAll)
|
||||
showAll = !showAll
|
||||
settings.showAll = showAll
|
||||
}
|
||||
ttrss.setShowAll(newValue)
|
||||
|
||||
onShowAllChanged: {
|
||||
// send the signal only if this is not the initial assignment
|
||||
if (notInitialAssignment) {
|
||||
updateView(showAll)
|
||||
}
|
||||
}
|
||||
// update settings
|
||||
settings.showAll = newValue
|
||||
|
||||
Component.onCompleted: {
|
||||
showAll = settings.showAll
|
||||
var ttrss = rootWindow.getTTRSS()
|
||||
ttrss.setShowAll(showAll)
|
||||
notInitialAssignment = true
|
||||
}
|
||||
|
||||
onVisibleChanged: {
|
||||
if (visible && notInitialAssignment) {
|
||||
var ttrss = rootWindow.getTTRSS()
|
||||
showAll = ttrss.getShowAll()
|
||||
}
|
||||
// inform about change
|
||||
updateView()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ Page {
|
|||
enabled: listView.count == 0
|
||||
text: network.loading ?
|
||||
qsTr("Loading") :
|
||||
(rootWindow.showAll ?
|
||||
(settings.showAll ?
|
||||
qsTr("No categories to display") :
|
||||
qsTr("No categories have unread items"))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ Page {
|
|||
enabled: listView.count == 0
|
||||
text: network.loading ?
|
||||
qsTr("Loading") :
|
||||
rootWindow.showAll ? qsTr("No items in feed") : qsTr("No unread items in feed")
|
||||
settings.showAll ? qsTr("No items in feed") : qsTr("No unread items in feed")
|
||||
}
|
||||
BusyIndicator {
|
||||
visible: listView.count != 0 && network.loading
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ Page {
|
|||
enabled: listView.count == 0
|
||||
text: network.loading ?
|
||||
qsTr("Loading") :
|
||||
rootWindow.showAll ? qsTr("No feeds in category") : qsTr("Category has no unread items")
|
||||
settings.showAll ? qsTr("No feeds in category") : qsTr("Category has no unread items")
|
||||
}
|
||||
BusyIndicator {
|
||||
visible: listView.count != 0 && network.loading
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ Dialog {
|
|||
|
||||
function startLogin() {
|
||||
var ttrss = rootWindow.getTTRSS()
|
||||
ttrss.initState()
|
||||
ttrss.initState(settings.showAll)
|
||||
ttrss.setLoginDetails(username.text, password.text, server.text)
|
||||
|
||||
// BUGFIX somehow the silica QML Image can not display images
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue