Tabs and Feeds UI improvements
This commit is contained in:
parent
1b7807fbc6
commit
89a23f5ba6
17 changed files with 307 additions and 355 deletions
|
|
@ -84,66 +84,67 @@ images.path = /usr/share/$${TARGET}/images
|
|||
INSTALLS += images
|
||||
|
||||
OTHER_FILES += \
|
||||
AboutPage.qml \
|
||||
AccountsDialog.qml \
|
||||
ActiveDetector.qml \
|
||||
AuthWebViewPage.qml \
|
||||
ButtonItem.qml \
|
||||
CachedImage.qml \
|
||||
ChangelogPage.qml \
|
||||
ControlBar.qml \
|
||||
CoverPage.qml \
|
||||
DashboardDialog.qml \
|
||||
DashboardPage.qml \
|
||||
DebugPage.qml \
|
||||
Dot.qml \
|
||||
EntryDelegate.qml \
|
||||
EntryPageContent.qml \
|
||||
EntryPage.qml \
|
||||
ErrorPage.qml \
|
||||
FeedIcon.qml \
|
||||
FeedPage.qml \
|
||||
FeedWebContentPage.qml \
|
||||
FirstPage.qml \
|
||||
Guide.qml \
|
||||
HintLabel.qml \
|
||||
IconBarItem.qml \
|
||||
IconBar.qml \
|
||||
IconContextMenu.qml \
|
||||
IconMenuItem.qml \
|
||||
IconPlaceholder.qml \
|
||||
IconSlider.qml \
|
||||
LogItem.qml \
|
||||
main.qml \
|
||||
MenuIconItem.qml \
|
||||
Notification.qml \
|
||||
NvSignInDialog.qml \
|
||||
OldReaderSignInDialog.qml \
|
||||
PaddedLabel.qml \
|
||||
PageMenu.qml \
|
||||
PocketAuthWebViewPage.qml \
|
||||
PocketDialog.qml \
|
||||
Pocket.qml \
|
||||
ProgressPanel.qml \
|
||||
ReadAllDialog.qml \
|
||||
SettingsPage.qml \
|
||||
ShareDialog.qml \
|
||||
ShareLinkPage.qml \
|
||||
SignOutDialog.qml \
|
||||
SmallIconButton.qml \
|
||||
Spacer.qml \
|
||||
TabPage.qml \
|
||||
TempBaner.qml \
|
||||
TextAreaItem.qml \
|
||||
TextFieldItem.qml \
|
||||
TextSwitchWithIcon.qml \
|
||||
TTRssSignInDialog.qml \
|
||||
UnreadAllDialog.qml \
|
||||
WebPreviewPage.qml \
|
||||
ClickableLabel.qml
|
||||
qml/AboutPage.qml \
|
||||
qml/AccountsDialog.qml \
|
||||
qml/ActiveDetector.qml \
|
||||
qml/AuthWebViewPage.qml \
|
||||
qml/ButtonItem.qml \
|
||||
qml/CachedImage.qml \
|
||||
qml/ChangelogPage.qml \
|
||||
qml/ControlBar.qml \
|
||||
qml/CoverPage.qml \
|
||||
qml/DashboardDialog.qml \
|
||||
qml/DashboardPage.qml \
|
||||
qml/DebugPage.qml \
|
||||
qml/Dot.qml \
|
||||
qml/EntryDelegate.qml \
|
||||
qml/EntryPageContent.qml \
|
||||
qml/EntryPage.qml \
|
||||
qml/ErrorPage.qml \
|
||||
qml/FeedIcon.qml \
|
||||
qml/FeedPage.qml \
|
||||
qml/FeedWebContentPage.qml \
|
||||
qml/FirstPage.qml \
|
||||
qml/Guide.qml \
|
||||
qml/HintLabel.qml \
|
||||
qml/IconBarItem.qml \
|
||||
qml/IconBar.qml \
|
||||
qml/IconContextMenu.qml \
|
||||
qml/IconMenuItem.qml \
|
||||
qml/IconPlaceholder.qml \
|
||||
qml/IconSlider.qml \
|
||||
qml/LogItem.qml \
|
||||
qml/main.qml \
|
||||
qml/MenuIconItem.qml \
|
||||
qml/Notification.qml \
|
||||
qml/NvSignInDialog.qml \
|
||||
qml/OldReaderSignInDialog.qml \
|
||||
qml/PaddedLabel.qml \
|
||||
qml/PageMenu.qml \
|
||||
qml/PocketAuthWebViewPage.qml \
|
||||
qml/PocketDialog.qml \
|
||||
qml/Pocket.qml \
|
||||
qml/ProgressPanel.qml \
|
||||
qml/ReadAllDialog.qml \
|
||||
qml/SettingsPage.qml \
|
||||
qml/ShareDialog.qml \
|
||||
qml/ShareLinkPage.qml \
|
||||
qml/SignOutDialog.qml \
|
||||
qml/SmallIconButton.qml \
|
||||
qml/Spacer.qml \
|
||||
qml/TabPage.qml \
|
||||
qml/TempBaner.qml \
|
||||
qml/TextAreaItem.qml \
|
||||
qml/TextFieldItem.qml \
|
||||
qml/TextSwitchWithIcon.qml \
|
||||
qml/TTRssSignInDialog.qml \
|
||||
qml/UnreadAllDialog.qml \
|
||||
qml/WebPreviewPage.qml \
|
||||
qml/ClickableLabel.qml \
|
||||
qml/SimpleListItem.qml \
|
||||
qml/UnreadBox.qml
|
||||
|
||||
OTHER_FILES += \
|
||||
rpm/$${TARGET}.yaml \
|
||||
rpm/$${TARGET}.changes.in \
|
||||
rpm/$${TARGET}.spec
|
||||
|
||||
|
|
|
|||
|
|
@ -48,53 +48,17 @@ Page {
|
|||
model: ListModel {
|
||||
ListElement { name: "Netvibes"; iconSource: "image://icons/icon-m-netvibes"; type: 1}
|
||||
ListElement { name: "Old Reader"; iconSource: "image://icons/icon-m-oldreader"; type: 2}
|
||||
ListElement { name: "Tiny Tiny Rss"; iconSource: "image://icons/icon-m-ttrss"; type: 4}
|
||||
ListElement { name: "Tiny Tiny RSS"; iconSource: "image://icons/icon-m-ttrss"; type: 4}
|
||||
}
|
||||
|
||||
header: PageHeader {
|
||||
title: qsTr("Add account")
|
||||
}
|
||||
|
||||
delegate: ListItem {
|
||||
id: listItem
|
||||
contentHeight: item.height + 2 * Theme.paddingMedium
|
||||
delegate: SimpleListItem {
|
||||
highlighted: root.accountType === type
|
||||
enabled: type != 3
|
||||
opacity: enabled ? 1.0 : 0.5
|
||||
|
||||
Column {
|
||||
id: item
|
||||
spacing: Theme.paddingSmall
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: parent.width
|
||||
|
||||
Item {
|
||||
anchors.left: parent.left; anchors.right: parent.right;
|
||||
height: Math.max(icon.height,label.height)
|
||||
|
||||
Image {
|
||||
id: icon
|
||||
anchors { left: parent.left }
|
||||
width: 1.2*Theme.iconSizeSmall
|
||||
height: 1.2*Theme.iconSizeSmall
|
||||
source: iconSource
|
||||
}
|
||||
|
||||
Label {
|
||||
id: label
|
||||
wrapMode: Text.AlignLeft
|
||||
anchors {
|
||||
left: icon.right
|
||||
right: parent.right;
|
||||
leftMargin: Theme.paddingMedium
|
||||
rightMargin: Theme.paddingLarge
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
text: name
|
||||
color: listItem.down ? Theme.highlightColor : Theme.primaryColor
|
||||
}
|
||||
}
|
||||
}
|
||||
icon: iconSource
|
||||
title: name
|
||||
|
||||
onClicked: {
|
||||
if (type == 1) {
|
||||
|
|
|
|||
|
|
@ -39,16 +39,16 @@ Image {
|
|||
}
|
||||
|
||||
onOrgSourceChanged: {
|
||||
if (orgSource !== "") {
|
||||
if (orgSource.length > 0) {
|
||||
if (cached) {
|
||||
var cachedUrl = app._cache.getUrlbyUrl(orgSource)
|
||||
if (cachedUrl === "") {
|
||||
var cachedSource = cserver.getPathByUrl(orgSource)
|
||||
if (cachedSource.length === 0) {
|
||||
if (!settings.offlineMode && dm.online) {
|
||||
cached = false
|
||||
source = orgSource
|
||||
}
|
||||
} else {
|
||||
source = cachedUrl
|
||||
source = cachedSource
|
||||
}
|
||||
} else {
|
||||
source = orgSource
|
||||
|
|
@ -59,7 +59,7 @@ Image {
|
|||
}
|
||||
|
||||
onStatusChanged: {
|
||||
if (cached && orgSource !== "" && status===Image.Error &&
|
||||
if (cached && orgSource.length > 0 && status === Image.Error &&
|
||||
!settings.offlineMode && dm.online) {
|
||||
cached = false
|
||||
source = orgSource
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2014 Michal Kosciesza <michal@mkiol.net>
|
||||
Copyright (C) 2014-2019 Michal Kosciesza <michal@mkiol.net>
|
||||
|
||||
This file is part of Kaktus.
|
||||
|
||||
|
|
@ -54,32 +54,14 @@ Dialog {
|
|||
acceptText : qsTr("Change")
|
||||
}
|
||||
|
||||
delegate: ListItem {
|
||||
id: listItem
|
||||
contentHeight: item.height + 2 * Theme.paddingMedium
|
||||
|
||||
Column {
|
||||
id: item
|
||||
spacing: Theme.paddingSmall
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: parent.width
|
||||
|
||||
Label {
|
||||
wrapMode: Text.AlignLeft
|
||||
anchors.left: parent.left; anchors.right: parent.right;
|
||||
anchors.leftMargin: Theme.paddingLarge; anchors.rightMargin: Theme.paddingLarge
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
text: title
|
||||
color: listItem.down ? Theme.highlightColor : Theme.primaryColor
|
||||
}
|
||||
}
|
||||
delegate: SimpleListItem {
|
||||
title: model.title
|
||||
|
||||
onClicked: {
|
||||
settings.dashboardInUse = uid;
|
||||
root.canAccept = true;
|
||||
root.accept();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ViewPlaceholder {
|
||||
|
|
@ -91,9 +73,5 @@ Dialog {
|
|||
VerticalScrollDecorator {
|
||||
flickable: listView
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
onAccepted: {
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ Page {
|
|||
objectName: "EntryDelegate"
|
||||
landscapeMode: root.landscapeMode
|
||||
onlineurl: model.link
|
||||
offlineurl: cache.getUrlbyId(model.uid)
|
||||
offlineurl: cserver.getUrlbyId(model.uid)
|
||||
evaluation: ai.evaluation(model.uid)
|
||||
|
||||
signal singleEntryClicked
|
||||
|
|
|
|||
|
|
@ -34,8 +34,6 @@ SilicaFlickable {
|
|||
signal clicked
|
||||
signal openClicked
|
||||
|
||||
function getUrlbyUrl(url){return cache.getUrlbyUrl(url)}
|
||||
|
||||
contentWidth: width
|
||||
contentHeight: column.height
|
||||
|
||||
|
|
@ -76,7 +74,8 @@ SilicaFlickable {
|
|||
Behavior on opacity { FadeAnimation {} }
|
||||
source: {
|
||||
if (root.image!="") {
|
||||
return settings.offlineMode ? getUrlbyUrl(root.image) : dm.online ? root.image : getUrlbyUrl(root.image);
|
||||
return settings.offlineMode ? cserver.getUrlbyUrl(root.image) :
|
||||
dm.online ? root.image : cserver.getUrlbyUrl(root.image);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,9 +61,8 @@ Page {
|
|||
model: feedModel
|
||||
|
||||
anchors { top: parent.top; left: parent.left; right: parent.right }
|
||||
clip:true
|
||||
|
||||
height: app.flickHeight
|
||||
clip: true
|
||||
|
||||
PageMenu {
|
||||
id: menu
|
||||
|
|
@ -71,122 +70,50 @@ Page {
|
|||
}
|
||||
|
||||
header: PageHeader {
|
||||
title: settings.viewMode==2 ? qsTr("Feeds") : root.title
|
||||
title: settings.viewMode == 2 ? qsTr("Feeds") : root.title
|
||||
}
|
||||
|
||||
delegate: ListItem {
|
||||
id: listItem
|
||||
|
||||
property bool last: model.uid==="last"
|
||||
delegate: SimpleListItem {
|
||||
property bool last: model.uid === "last"
|
||||
property bool defaultIcon: model.icon === "http://s.theoldreader.com/icons/user_icon.png"
|
||||
|
||||
showPlaceholder: true
|
||||
small: true
|
||||
title: model.title
|
||||
icon: defaultIcon ? "image://icons/icon-m-friend" : model.icon
|
||||
enabled: !last
|
||||
contentHeight: last ? app.stdHeight : Math.max(item.height, image.height) + 2 * Theme.paddingMedium
|
||||
|
||||
Rectangle {
|
||||
anchors.top: parent.top; anchors.right: parent.right
|
||||
width: Theme.paddingSmall; height: item.height
|
||||
visible: model.fresh && !listItem.last
|
||||
radius: 10
|
||||
|
||||
gradient: Gradient {
|
||||
GradientStop { position: 0.0; color: Theme.rgba(Theme.highlightColor, 0.4) }
|
||||
GradientStop { position: 1.0; color: Theme.rgba(Theme.highlightColor, 0.0) }
|
||||
}
|
||||
}
|
||||
|
||||
FeedIcon {
|
||||
id: image
|
||||
visible: !listItem.last
|
||||
y: Theme.paddingMedium
|
||||
anchors.left: parent.left
|
||||
showPlaceholder: true
|
||||
showBackground: !listItem.defaultIcon
|
||||
source: listItem.defaultIcon ? "image://icons/icon-m-friend" : model.icon
|
||||
text: model.title
|
||||
width: visible ? 1.2*Theme.iconSizeSmall : 0
|
||||
height: width
|
||||
}
|
||||
|
||||
Label {
|
||||
id: item
|
||||
visible: !listItem.last
|
||||
wrapMode: Text.AlignLeft
|
||||
y: Theme.paddingMedium
|
||||
anchors {
|
||||
left: image.visible ? image.right : parent.left
|
||||
right: unreadbox.visible ? unreadbox.left : parent.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
leftMargin: Theme.paddingLarge
|
||||
rightMargin: Theme.paddingLarge
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
text: model.title
|
||||
color: listItem.down ?
|
||||
(model.unread ? Theme.highlightColor : Theme.secondaryHighlightColor) :
|
||||
(model.unread ? Theme.primaryColor : Theme.secondaryColor)
|
||||
}
|
||||
|
||||
/*Column {
|
||||
id: item
|
||||
spacing: 0.5*Theme.paddingSmall
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
//anchors.left: image.visible ? image.right : Theme.fontSizeMedium
|
||||
anchors.right: unreadbox.visible ? unreadbox.left : parent.right
|
||||
visible: !listItem.last
|
||||
}*/
|
||||
|
||||
Rectangle {
|
||||
id: unreadbox
|
||||
y: Theme.paddingSmall
|
||||
anchors {
|
||||
right: parent.right
|
||||
rightMargin: Theme.paddingLarge
|
||||
}
|
||||
width: unreadlabel.width + 2 * Theme.paddingSmall
|
||||
height: unreadlabel.height + 2 * Theme.paddingSmall
|
||||
color: Theme.rgba(Theme.highlightBackgroundColor, 0.2)
|
||||
radius: 5
|
||||
visible: model.unread!==0 && !listItem.last
|
||||
|
||||
Label {
|
||||
id: unreadlabel
|
||||
anchors.centerIn: parent
|
||||
text: model.unread
|
||||
color: Theme.highlightColor
|
||||
}
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
if (!listItem.last) {
|
||||
utils.setEntryModel(uid);
|
||||
pageStack.push(Qt.resolvedUrl("EntryPage.qml"),{"title": title, "index": model.index, "readlater": false});
|
||||
}
|
||||
}
|
||||
|
||||
showMenuOnPressAndHold: !listItem.last && (readItem.enabled || unreadItem.enabled)
|
||||
unreadCount: enabled ? model.unread : 0
|
||||
|
||||
menu: ContextMenu {
|
||||
id: contextMenu
|
||||
MenuItem {
|
||||
id: readItem
|
||||
text: qsTr("Mark all as read")
|
||||
enabled: model.unread!==0
|
||||
enabled: model.unread !== 0
|
||||
visible: enabled
|
||||
onClicked: {
|
||||
feedModel.markAsRead(model.index);
|
||||
feedModel.markAsRead(model.index)
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
id: unreadItem
|
||||
text: qsTr("Mark all as unread")
|
||||
enabled: model.read!==0 && settings.signinType<10
|
||||
enabled: model.read !== 0 && settings.signinType < 10 // Only Netvibes
|
||||
visible: enabled
|
||||
onClicked: {
|
||||
feedModel.markAsUnread(model.index);
|
||||
feedModel.markAsUnread(model.index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
openMenuOnPressAndHold: enabled && (readItem.enabled || unreadItem.enabled)
|
||||
|
||||
onClicked: {
|
||||
if (enabled) {
|
||||
utils.setEntryModel(uid);
|
||||
pageStack.push(Qt.resolvedUrl("EntryPage.qml"),
|
||||
{"title": title.text, "index": model.index, "readlater": false})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ViewPlaceholder {
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ Rectangle {
|
|||
Timer {
|
||||
id: timer1
|
||||
interval: 3000
|
||||
onTriggered: {s
|
||||
onTriggered: {
|
||||
root.show();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,11 +37,12 @@ Rectangle {
|
|||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
var r = text.length>0 ? hash(text,0)/255 : 1
|
||||
var g = text.length>1 ? hash(text,1)/255 : 1
|
||||
var b = text.length>2 ? hash(text,2)/255 : 1
|
||||
var colorBg = Qt.rgba(r,g,b,0.8)
|
||||
var colorFg = (r+g+b)>1.5 ? Qt.rgba(0,0,0,1) : Qt.rgba(1,1,1,1)
|
||||
var r = text.length > 0 ? hash(text,0)/255 : 1
|
||||
var g = text.length > 1 ? hash(text,1)/255 : 1
|
||||
var b = text.length > 2 ? hash(text,2)/255 : 1
|
||||
var base = Qt.rgba(r, g, b, .8)
|
||||
var colorBg = Qt.darker(base, 1.5)
|
||||
var colorFg = Qt.lighter(base, 3.0)
|
||||
color = colorBg
|
||||
label.color = colorFg
|
||||
}
|
||||
|
|
@ -51,7 +52,7 @@ Rectangle {
|
|||
text: root.text.substring(0,1).toUpperCase()
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
font.pixelSize: root.height * 0.8
|
||||
anchors.fill: parent
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ Page {
|
|||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: app.isNetvibes ? "Netvibes":
|
||||
app.isOldReader ? "Old Reader" :
|
||||
app.isTTRss ? "Tiny Tiny Rss" : null
|
||||
app.isTTRss ? "Tiny Tiny RSS" : null
|
||||
color: Theme.highlightColor
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
}
|
||||
|
|
|
|||
93
sailfish/qml/SimpleListItem.qml
Normal file
93
sailfish/qml/SimpleListItem.qml
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
Copyright (C) 2017-2019 Michal Kosciesza <michal@mkiol.net>
|
||||
|
||||
This file is part of Kaktus.
|
||||
|
||||
Kaktus 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.
|
||||
|
||||
Kaktus 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 Kaktus. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
|
||||
ListItem {
|
||||
id: root
|
||||
|
||||
property alias title: _title.text
|
||||
property alias icon: _icon.orgSource
|
||||
property bool showPlaceholder: false
|
||||
property int unreadCount: 0
|
||||
property bool small: false
|
||||
|
||||
contentHeight: small ? Theme.itemSizeSmall : Theme.itemSizeMedium
|
||||
|
||||
anchors {
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
|
||||
IconPlaceholder {
|
||||
// placeholder
|
||||
id: placeholder
|
||||
anchors {
|
||||
left: parent.left
|
||||
leftMargin: Theme.horizontalPageMargin
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
visible: root.showPlaceholder &&
|
||||
_icon.status !== Image.Ready &&
|
||||
title.length > 0
|
||||
height: root.small ? Theme.iconSizeMedium * 0.8 : Theme.iconSizeMedium
|
||||
width: height
|
||||
text: title
|
||||
}
|
||||
|
||||
CachedImage {
|
||||
id: _icon
|
||||
anchors {
|
||||
left: parent.left
|
||||
leftMargin: Theme.horizontalPageMargin
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
height: root.small ? Theme.iconSizeMedium * 0.8 : Theme.iconSizeMedium
|
||||
width: height
|
||||
}
|
||||
|
||||
Label {
|
||||
id: _title
|
||||
|
||||
truncationMode: TruncationMode.Fade
|
||||
|
||||
anchors {
|
||||
left: _icon.status !== Image.Ready &&
|
||||
!placeholder.visible ? parent.left : _icon.right
|
||||
right: unreadBox.visible ? unreadBox.left : parent.right
|
||||
leftMargin: Theme.horizontalPageMargin;
|
||||
rightMargin: Theme.horizontalPageMargin;
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
color: root.highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
}
|
||||
|
||||
UnreadBox {
|
||||
id: unreadBox
|
||||
anchors {
|
||||
right: parent.right
|
||||
rightMargin: Theme.horizontalPageMargin
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
count: root.unreadCount
|
||||
visible: count > 0
|
||||
}
|
||||
}
|
||||
|
|
@ -58,7 +58,7 @@ Page {
|
|||
|
||||
anchors { top: parent.top; left: parent.left; right: parent.right }
|
||||
height: app.flickHeight
|
||||
clip:true
|
||||
clip: true
|
||||
|
||||
PageMenu {
|
||||
id: menu
|
||||
|
|
@ -66,126 +66,57 @@ Page {
|
|||
}
|
||||
|
||||
header: PageHeader {
|
||||
title: settings.signinType<10 ? qsTr("Tabs") : qsTr("Folders")
|
||||
title: settings.signinType < 10 ? qsTr("Tabs") : qsTr("Folders")
|
||||
}
|
||||
|
||||
delegate: Item {
|
||||
delegate: SimpleListItem {
|
||||
property bool last: model.uid === "last"
|
||||
|
||||
anchors.left: parent.left; anchors.right: parent.right
|
||||
height: listItem.height
|
||||
small: true
|
||||
showPlaceholder: true
|
||||
title: model.uid === "subscriptions" ? qsTr("Subscriptions") :
|
||||
model.uid === "friends" ? qsTr("Following") :
|
||||
model.uid === "global.uncategorized" ? qsTr("Uncategorized") :
|
||||
model.title
|
||||
icon: model.uid === "friends" ? "image://icons/icon-m-friend" :
|
||||
model.iconUrl.length > 0 ? iconUrl : ""
|
||||
enabled: !last
|
||||
unreadCount: enabled ? model.unread : 0
|
||||
|
||||
ListItem {
|
||||
id: listItem
|
||||
|
||||
property bool last: model.uid=="last"
|
||||
property string title: model.uid=="subscriptions" ? qsTr("Subscriptions") :
|
||||
model.uid=="friends" ? qsTr("Following") :
|
||||
model.uid=="global.uncategorized" ? qsTr("Uncategorized") : model.title
|
||||
property string imageSource: model.uid=="friends" ? "image://icons/icon-m-friend?"+Theme.primaryColor :
|
||||
model.iconUrl != "" ? cache.getUrlbyUrl(iconUrl) : ""
|
||||
enabled: !last
|
||||
|
||||
anchors.top: parent.top
|
||||
contentHeight: last ? app.stdHeight : Math.max(item.height, image.height) + 2 * Theme.paddingMedium;
|
||||
|
||||
Rectangle {
|
||||
anchors.top: parent.top; anchors.right: parent.right
|
||||
width: Theme.paddingSmall; height: item.height
|
||||
visible: model.fresh && !listItem.last
|
||||
radius: 10
|
||||
|
||||
gradient: Gradient {
|
||||
GradientStop { position: 0.0; color: Theme.rgba(Theme.highlightColor, 0.4) }
|
||||
GradientStop { position: 1.0; color: Theme.rgba(Theme.highlightColor, 0.0) }
|
||||
menu: ContextMenu {
|
||||
MenuItem {
|
||||
id: readItem
|
||||
text: qsTr("Mark all as read")
|
||||
enabled: model.unread !== 0
|
||||
visible: enabled
|
||||
onClicked: {
|
||||
tabModel.markAsRead(model.index)
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
id: item
|
||||
visible: !listItem.last
|
||||
wrapMode: Text.AlignLeft
|
||||
y: Theme.paddingMedium
|
||||
anchors {
|
||||
left: image.visible ? image.right : parent.left
|
||||
right: unreadbox.visible ? unreadbox.left : parent.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
leftMargin: Theme.paddingLarge
|
||||
rightMargin: Theme.paddingLarge
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeMedium
|
||||
color: listItem.down ?
|
||||
(model.unread ? Theme.highlightColor : Theme.secondaryHighlightColor) :
|
||||
(model.unread ? Theme.primaryColor : Theme.secondaryColor)
|
||||
text: listItem.title
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: unreadbox
|
||||
y: Theme.paddingSmall
|
||||
anchors {
|
||||
right: parent.right
|
||||
rightMargin: Theme.paddingLarge
|
||||
}
|
||||
width: unreadlabel.width + 3 * Theme.paddingSmall
|
||||
height: unreadlabel.height + 2 * Theme.paddingSmall
|
||||
color: Theme.rgba(Theme.highlightBackgroundColor, 0.2)
|
||||
radius: 5
|
||||
visible: model.unread !==0 && !listItem.last
|
||||
|
||||
Label {
|
||||
id: unreadlabel
|
||||
anchors.centerIn: parent
|
||||
text: model.unread
|
||||
color: Theme.highlightColor
|
||||
MenuItem {
|
||||
id: unreadItem
|
||||
text: qsTr("Mark all as unread")
|
||||
enabled: model.read !== 0 && settings.signinType < 10 // Only Netvibes
|
||||
visible: enabled
|
||||
onClicked: {
|
||||
tabModel.markAsUnread(model.index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FeedIcon {
|
||||
id: image
|
||||
visible: !listItem.last
|
||||
y: Theme.paddingMedium
|
||||
anchors.left: parent.left
|
||||
showPlaceholder: true
|
||||
showBackground: false
|
||||
source: listItem.imageSource
|
||||
text: listItem.title
|
||||
width: visible ? 1.2*Theme.iconSizeSmall : 0
|
||||
height: width
|
||||
}
|
||||
openMenuOnPressAndHold: enabled && (readItem.enabled || unreadItem.enabled)
|
||||
|
||||
onClicked: {
|
||||
if (!listItem.last) {
|
||||
if (settings.viewMode == 0) {
|
||||
utils.setFeedModel(uid);
|
||||
pageStack.push(Qt.resolvedUrl("FeedPage.qml"),{"title": model.uid==="subscriptions" ? qsTr("Subscriptions") : model.uid=="friends" ? qsTr("Following") : model.uid=="global.uncategorized" ? qsTr("Uncategorized") : title, "index": model.index});
|
||||
}
|
||||
if (settings.viewMode == 1) {
|
||||
utils.setEntryModel(uid);
|
||||
pageStack.push(Qt.resolvedUrl("EntryPage.qml"),{"title": model.uid==="subscriptions" ? qsTr("Subscriptions") : model.uid=="friends" ? qsTr("Following") : model.uid=="global.uncategorized" ? qsTr("Uncategorized") : title, "readlater": false});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
showMenuOnPressAndHold: !listItem.last && (readItem.enabled || unreadItem.enabled)
|
||||
|
||||
menu: ContextMenu {
|
||||
MenuItem {
|
||||
id: readItem
|
||||
text: qsTr("Mark all as read")
|
||||
enabled: model.unread!==0
|
||||
visible: enabled
|
||||
onClicked: {
|
||||
tabModel.markAsRead(model.index);
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
id: unreadItem
|
||||
text: qsTr("Mark all as unread")
|
||||
enabled: model.read!==0 && settings.signinType<10
|
||||
visible: enabled
|
||||
onClicked: {
|
||||
tabModel.markAsUnread(model.index);
|
||||
}
|
||||
onClicked: {
|
||||
if (enabled) {
|
||||
var vm = settings.viewMode
|
||||
if (vm == 0) {
|
||||
utils.setFeedModel(uid);
|
||||
pageStack.push(Qt.resolvedUrl("FeedPage.qml"),
|
||||
{"title": title.text, "index": model.index})
|
||||
} else if (vm == 1) {
|
||||
utils.setEntryModel(uid);
|
||||
pageStack.push(Qt.resolvedUrl("EntryPage.qml"),
|
||||
{"title": title.text, "readlater": false})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -195,7 +126,7 @@ Page {
|
|||
id: placeholder
|
||||
enabled: listView.count < 1
|
||||
text: fetcher.busy ? qsTr("Wait until sync finish") :
|
||||
settings.signinType<10 ? qsTr("No tabs") : qsTr("No folders")
|
||||
settings.signinType < 10 ? qsTr("No tabs") : qsTr("No folders")
|
||||
}
|
||||
|
||||
VerticalScrollDecorator {
|
||||
|
|
|
|||
37
sailfish/qml/UnreadBox.qml
Normal file
37
sailfish/qml/UnreadBox.qml
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
Copyright (C) 2014-2019 Michal Kosciesza <michal@mkiol.net>
|
||||
|
||||
This file is part of Kaktus.
|
||||
|
||||
Kaktus 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.
|
||||
|
||||
Kaktus 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 Kaktus. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
|
||||
Rectangle {
|
||||
property int count
|
||||
|
||||
width: unreadlabel.width + 3 * Theme.paddingSmall
|
||||
height: unreadlabel.height + 2 * Theme.paddingSmall
|
||||
color: Theme.rgba(Theme.highlightBackgroundColor, 0.2)
|
||||
radius: 5
|
||||
|
||||
Label {
|
||||
id: unreadlabel
|
||||
text: count
|
||||
anchors.centerIn: parent
|
||||
color: Theme.highlightColor
|
||||
}
|
||||
}
|
||||
|
|
@ -31,7 +31,6 @@ ApplicationWindow {
|
|||
readonly property bool isNetvibes: settings.signinType >= 0 && settings.signinType < 10
|
||||
readonly property bool isOldReader: settings.signinType >= 10 && settings.signinType < 20
|
||||
readonly property bool isTTRss: settings.signinType >= 30 && settings.signinType < 40
|
||||
readonly property variant _cache: cache
|
||||
readonly property int stdHeight: orientation==Orientation.Portrait ? Theme.itemSizeMedium : 0.8 * Theme.itemSizeMedium
|
||||
|
||||
cover: CoverPage {}
|
||||
|
|
|
|||
|
|
@ -499,8 +499,6 @@ QString CacheServer::getUrlbyId(const QString &item)
|
|||
|
||||
QString CacheServer::getUrlbyUrl(const QString &url)
|
||||
{
|
||||
//qDebug() << "getUrlbyUrl, url=" << url << "hash=" << Utils::hash(url);
|
||||
|
||||
if (url.isEmpty()) {
|
||||
return url;
|
||||
}
|
||||
|
|
@ -517,12 +515,34 @@ QString CacheServer::getUrlbyUrl(const QString &url)
|
|||
|
||||
QString filename = Utils::hash(url);
|
||||
Settings *s = Settings::instance();
|
||||
if (!QFile::exists(s->getDmCacheDir() + "/" + filename)) {
|
||||
qWarning() << "File " << filename << "does not exists!";
|
||||
return "";
|
||||
QString path = QDir(s->getDmCacheDir()).absoluteFilePath(filename);
|
||||
|
||||
return QFile::exists(path) ?
|
||||
"http://localhost:" + QString::number(port) + "/" + filename :
|
||||
"";
|
||||
}
|
||||
|
||||
QString CacheServer::getPathByUrl(const QString &url)
|
||||
{
|
||||
if (url.isEmpty()) {
|
||||
return url;
|
||||
}
|
||||
|
||||
return "http://localhost:" + QString::number(port) + "/" + filename;
|
||||
// If url is "image://" will not be hashed
|
||||
if (url.startsWith("image://")) {
|
||||
return url;
|
||||
}
|
||||
|
||||
// If url is "http://localhost" will not be hashed
|
||||
if (url.startsWith("http://localhost")) {
|
||||
return url;
|
||||
}
|
||||
|
||||
QString filename = Utils::hash(url);
|
||||
Settings *s = Settings::instance();
|
||||
QString path = QDir(s->getDmCacheDir()).absoluteFilePath(filename);
|
||||
|
||||
return QFile::exists(path) ? path : "";
|
||||
}
|
||||
|
||||
QByteArray CacheServer::getDataUrlByUrl(const QString &url)
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ public:
|
|||
Q_INVOKABLE QString getUrlbyId(const QString &item);
|
||||
Q_INVOKABLE QString getUrlbyUrl(const QString &item);
|
||||
Q_INVOKABLE QString getCacheUrlbyUrl(const QString &item);
|
||||
Q_INVOKABLE QString getPathByUrl(const QString &url);
|
||||
|
||||
public slots:
|
||||
void handle(QHttpRequest *req, QHttpResponse *resp);
|
||||
|
|
|
|||
|
|
@ -141,6 +141,7 @@ int main(int argc, char *argv[])
|
|||
context->setContextProperty("utils", &utils);
|
||||
context->setContextProperty("dm", &dm);
|
||||
context->setContextProperty("cache", &cache);
|
||||
context->setContextProperty("cserver", &cache);
|
||||
context->setContextProperty("ai", &ai);
|
||||
context->setContextProperty("settings", settings);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue