Rework the articles display selection: use a separate dialog

pull/1/head
Grégory Oestreicher 2017-02-27 15:44:32 +01:00
parent 11e665b137
commit 779639baf1
6 changed files with 203 additions and 12 deletions

View File

@ -52,4 +52,6 @@ DISTFILES += \
qml/pages/SettingsPage.qml \
qml/types/Server.qml \
qml/types/ServerSettings.qml \
rpm/harbour-wallaread.changes
rpm/harbour-wallaread.changes \
qml/pages/ServerPageShowDialog.qml \
qml/types/ServerPageShowPreferences.qml

View File

@ -32,6 +32,7 @@ Page {
property int serverId
property alias server: server
property alias showPreferences: showPreferences
Server {
id: server
@ -46,6 +47,10 @@ Page {
}
}
ServerPageShowPreferences {
id: showPreferences
}
ArticlesModel {
id: articlesModel
@ -269,18 +274,14 @@ Page {
PullDownMenu {
MenuItem {
text: articlesModel.showStarred ? qsTr( "Show unstarred articles" ) : qsTr( "Show only starred articles" )
text: qsTr( "Show: " ) + showPreferences.getVisibleDescription()
onClicked: {
articlesModel.showStarred = !articlesModel.showStarred
serverPage.updateArticlesList()
}
}
MenuItem {
text: articlesModel.showRead ? qsTr( "Show unread articles" ) : qsTr( "Show read articles" )
onClicked: {
articlesModel.showRead = !articlesModel.showRead
var dlg = pageStack.push( Qt.resolvedUrl( "ServerPageShowDialog.qml" ), { preferences: showPreferences } )
dlg.accepted.connect( function() {
articlesModel.showStarred = showPreferences.starred
articlesModel.showRead = showPreferences.read
serverPage.updateArticlesList()
} )
}
}

View File

@ -0,0 +1,67 @@
/*
* WallaRead - A Wallabag 2+ client for SailfishOS
* © 2017 Grégory Oestreicher <greg@kamago.net>
*
* This file is part of WallaRead.
*
* WallaRead is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* WallaRead is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WallaRead. If not, see <http://www.gnu.org/licenses/>.
*
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
Dialog {
id: serverShowDialog
allowedOrientations: Orientation.All
canAccept: true
property variant preferences
onDone: {
if ( result === DialogResult.Accepted ) {
preferences.read = showReadSwitch.checked
preferences.starred = showStarredSwitch.checked
}
}
SilicaFlickable {
anchors.fill: parent
contentHeight: column.height
width: parent.width
Column {
id: column
width: parent.width
DialogHeader {
acceptText: qsTr( "Filter view" )
}
TextSwitch {
id: showReadSwitch
width: parent.width
checked: preferences.read
text: qsTr( "Read articles" )
}
TextSwitch {
id: showStarredSwitch
width: parent.width
checked: preferences.starred
text: qsTr( "Starred articles" )
}
}
}
}

View File

@ -0,0 +1,45 @@
/*
* WallaRead - A Wallabag 2+ client for SailfishOS
* © 2017 Grégory Oestreicher <greg@kamago.net>
*
* This file is part of WallaRead.
*
* WallaRead is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* WallaRead is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WallaRead. If not, see <http://www.gnu.org/licenses/>.
*
*/
import QtQuick 2.0
QtObject {
property bool read: false
property bool starred: false
function getVisibleDescription() {
var ret = ""
if ( read )
ret += qsTr( "read" )
else
ret += qsTr( "unread" )
ret += "/"
if ( starred )
ret += qsTr( "starred" )
else
ret += qsTr( "all" )
return ret
}
}

View File

@ -84,6 +84,44 @@
<source>Add article</source>
<translation>Ajouter un article</translation>
</message>
<message>
<source>Show: </source>
<translation>Afficher : </translation>
</message>
</context>
<context>
<name>ServerPageShowDialog</name>
<message>
<source>Filter view</source>
<translation>Filtrer la liste</translation>
</message>
<message>
<source>Read articles</source>
<translation>Articles lus</translation>
</message>
<message>
<source>Starred articles</source>
<translation>Articles favoris</translation>
</message>
</context>
<context>
<name>ServerPageShowPreferences</name>
<message>
<source>read</source>
<translation>lus</translation>
</message>
<message>
<source>unread</source>
<translation>non lus</translation>
</message>
<message>
<source>starred</source>
<translation>favoris</translation>
</message>
<message>
<source>all</source>
<translation>tous</translation>
</message>
</context>
<context>
<name>ServerSettings</name>

View File

@ -84,6 +84,44 @@
<source>Add article</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Show: </source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ServerPageShowDialog</name>
<message>
<source>Filter view</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Read articles</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Starred articles</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ServerPageShowPreferences</name>
<message>
<source>read</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>unread</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>starred</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>all</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ServerSettings</name>