1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
/*
license GPL v3 ...........
description of this file:
a page for viewing a user selected RSS feed ;
*/
import QtQuick 2.0
import QtQuick.XmlListModel 2.0
import Ubuntu.Components 0.1
import Ubuntu.Components.ListItems 0.1 as ListItem
import Ubuntu.Components.Popups 0.1
import "./dateutils.js" as DateUtils
import "databasemodule_v2.js" as DB
Page {
objectName: "rssfeedpage"
id: pageRoot
property alias articleView: innerArticleView
function setFeed(model, index) {
innerArticleView.setFeed(model, index)
}
ArticleViewItem {
id: innerArticleView
anchors.fill: parent
}
tools: ToolbarItems {
objectName: "pageBackBtn"
id: toolbar
ToolbarButton {
id: readingOptionsButton
visible: true
action: Action {
text: i18n.tr("Options")
iconSource: Qt.resolvedUrl("./icons_tmp/settings.svg")
onTriggered: {
PopupUtils.open(readingOptionsPopoverComponent, readingOptionsButton)
}
}
}
ToolbarButton {
action: Action {
text: innerArticleView.rssItem == null ? "" : (innerArticleView.rssItem.favourite == "0" ? i18n.tr("Save") : i18n.tr("Remove"))
iconSource: {
if (innerArticleView.rssItem == null || innerArticleView.rssItem.favourite == "0")
return Qt.resolvedUrl("./icons_tmp/favorite-unselected.svg")
else return Qt.resolvedUrl("./icons_tmp/favorite-selected.svg")
}
onTriggered: {
var fav = (innerArticleView.rssItem.favourite == "0" ? "1" : "0")
var dbResult = DB.updateArticleFavourite(innerArticleView.rssItem.id, fav)
if (dbResult.rowsAffected === 1) {
innerArticleView.articleFavouriteChanged(innerArticleView.rssItem, fav)
}
}
}
}
ToolbarButton {
action: Action {
text: i18n.tr("Open site")
iconSource: Qt.resolvedUrl("./icons_tmp/go-to.svg")
onTriggered: {
Qt.openUrlExternally(innerArticleView.rssItem.link)
}
}
}
}
Component {
id: readingOptionsPopoverComponent
ReadingOptions { }
} // Comp
}
|