removed webkit

This commit is contained in:
Jeena 2015-02-03 23:44:03 +01:00
parent 9c4799073b
commit 58b8bdbd31
2 changed files with 94 additions and 30 deletions

View file

@ -1,12 +1,10 @@
import QtWebKit 3.0 import QtQuick 2.0
import QtWebKit.experimental 1.0
import QtQuick.Controls 1.3 import QtQuick.Controls 1.3
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import QtQuick.Controls.Styles 1.3 import QtQuick.Controls.Styles 1.3
import TTRSS 1.0 import TTRSS 1.0
ScrollView { ScrollView {
id: content
property Post post property Post post
Layout.minimumWidth: 400 Layout.minimumWidth: 400
@ -14,31 +12,96 @@ ScrollView {
transientScrollBars: true transientScrollBars: true
} }
WebView { Item {
id: webView height: column.height + 20
url: "content.html" width: parent.parent.width
property Post post: content.post Rectangle {
anchors.fill: parent
width: parent.width
height: column.height
anchors.margins: 30
color: "transparent"
function setPost() { Column {
id: column
spacing: 10
width: parent.width
Label {
text: {
if(post) { if(post) {
experimental.evaluateJavaScript("setArticle(" + post.jsonString + ")") var str = post.feedTitle
if(post.author) {
str += " - " + post.author;
} }
} return str;
// Enable communication between QML and WebKit
experimental.preferences.navigatorQtObjectEnabled: true;
onNavigationRequested: {
if (request.navigationType != WebView.LinkClickedNavigation) {
request.action = WebView.AcceptRequest;
} else { } else {
request.action = WebView.IgnoreRequest; return ""
Qt.openUrlExternally(request.url); }
}
color: "gray"
font.pointSize: 16
wrapMode: Text.Wrap
width: parent.width
}
Label {
text: post ? post.title : ""
font.pointSize: 30
wrapMode: Text.Wrap
width: parent.width
}
Label {
text: post ? post.date.toLocaleString(Qt.locale(), Locale.LongFormat) : ""
color: "gray"
font.pointSize: 16
wrapMode: Text.Wrap
width: parent.width
}
Rectangle {
width: parent.width
height: 14
color: "transparent"
Rectangle {
width: parent.width
height: 1
anchors.top: parent.top
anchors.topMargin: 15
color: "lightgray"
visible: {
if(post) {
return true;
}
return false;
}
} }
} }
onLoadingChanged: setPost() Rectangle {
onPostChanged: setPost() height: contentLabel.height + 20
width: parent.width
color: "transparent"
Label {
id: contentLabel
text: post ? post.content : ""
font.pointSize: 16
wrapMode: Text.Wrap
width: parent.width
anchors.top: parent.top
anchors.topMargin: 20
lineHeight: 1.3
linkColor: "#555"
onLinkActivated: {
Qt.openUrlExternally(link)
}
}
}
}
}
} }
} }

View file

@ -1,4 +1,5 @@
import QtQuick 2.0 import QtQuick 2.0
import QtQuick.Controls 1.3
Component { Component {
id: component id: component
@ -25,26 +26,26 @@ Component {
Row { Row {
spacing: 10 spacing: 10
Text { Label {
text: feedTitle text: feedTitle
font.pointSize: 12 font.pointSize: 12
color: "gray" color: "gray"
wrapMode: Text.Wrap wrapMode: Text.Wrap
} }
Text { Label {
text: date.toLocaleString(null) text: date.toLocaleString(Qt.locale(), Locale.ShortFormat)
font.pointSize: 12 font.pointSize: 12
color: "gray" color: "gray"
wrapMode: Text.Wrap wrapMode: Text.Wrap
} }
} }
Text { Label {
text: title text: title
font.pointSize: 16 font.pointSize: 16
wrapMode: Text.Wrap wrapMode: Text.Wrap
width: parent.width width: parent.width
} }
Text { Label {
text: excerpt text: excerpt
font.pointSize: 12 font.pointSize: 12
color: "gray" color: "gray"