diff --git a/harbour-wallaread.pro b/harbour-wallaread.pro index 4719d38..9a1e39c 100644 --- a/harbour-wallaread.pro +++ b/harbour-wallaread.pro @@ -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 diff --git a/qml/pages/ServerPage.qml b/qml/pages/ServerPage.qml index cd3925d..75706ce 100644 --- a/qml/pages/ServerPage.qml +++ b/qml/pages/ServerPage.qml @@ -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 - serverPage.updateArticlesList() + var dlg = pageStack.push( Qt.resolvedUrl( "ServerPageShowDialog.qml" ), { preferences: showPreferences } ) + dlg.accepted.connect( function() { + articlesModel.showStarred = showPreferences.starred + articlesModel.showRead = showPreferences.read + serverPage.updateArticlesList() + } ) } } diff --git a/qml/pages/ServerPageShowDialog.qml b/qml/pages/ServerPageShowDialog.qml new file mode 100644 index 0000000..018f869 --- /dev/null +++ b/qml/pages/ServerPageShowDialog.qml @@ -0,0 +1,67 @@ +/* + * WallaRead - A Wallabag 2+ client for SailfishOS + * © 2017 Grégory Oestreicher + * + * 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 . + * + */ + +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" ) + } + } + } +} diff --git a/qml/types/ServerPageShowPreferences.qml b/qml/types/ServerPageShowPreferences.qml new file mode 100644 index 0000000..39e2153 --- /dev/null +++ b/qml/types/ServerPageShowPreferences.qml @@ -0,0 +1,45 @@ +/* + * WallaRead - A Wallabag 2+ client for SailfishOS + * © 2017 Grégory Oestreicher + * + * 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 . + * + */ + +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 + } +} diff --git a/translations/harbour-wallaread-fr.ts b/translations/harbour-wallaread-fr.ts index 3c9c0dc..45174cb 100644 --- a/translations/harbour-wallaread-fr.ts +++ b/translations/harbour-wallaread-fr.ts @@ -84,6 +84,44 @@ Add article Ajouter un article + + Show: + Afficher : + + + + ServerPageShowDialog + + Filter view + Filtrer la liste + + + Read articles + Articles lus + + + Starred articles + Articles favoris + + + + ServerPageShowPreferences + + read + lus + + + unread + non lus + + + starred + favoris + + + all + tous + ServerSettings diff --git a/translations/harbour-wallaread.ts b/translations/harbour-wallaread.ts index 75a475d..d3555c2 100644 --- a/translations/harbour-wallaread.ts +++ b/translations/harbour-wallaread.ts @@ -84,6 +84,44 @@ Add article + + Show: + + + + + ServerPageShowDialog + + Filter view + + + + Read articles + + + + Starred articles + + + + + ServerPageShowPreferences + + read + + + + unread + + + + starred + + + + all + + ServerSettings