Several bug fixes (#28)

* Fix control bar access when returning to parent pages
* Set entry as read upon entering FeedWebContentPage
* Don’t discard feed content if contains only an image
This commit is contained in:
Renaud Casenave-Péré 2019-02-17 00:37:33 +09:00 committed by Mkiol
parent 5fdd9270e1
commit 6c68ce950a
6 changed files with 20 additions and 10 deletions

View file

@ -144,7 +144,7 @@ Page {
}
ActiveDetector {
onInit: { bar.flick = listView;}
onInit: { bar.flick = listView }
}
RemorsePopup {

View file

@ -43,8 +43,13 @@ Page {
property int index
ActiveDetector {
onActivated: { feedModel.updateFlags() }
onInit: { bar.flick = listView }
onActivated: {
feedModel.updateFlags()
bar.flick = listView
}
onInit: {
bar.flick = listView
}
}
RemorsePopup {

View file

@ -38,6 +38,7 @@ Page {
property int index
property int feedindex
property bool cached
property bool autoRead: true
property variant _settings: settings
property bool themeApply: true
@ -48,6 +49,10 @@ Page {
view.loadHtml(utils.formatHtml(content, settings.offlineMode, ""))
navigateBackPop = true
themeApply = true
if (!read) {
read = true
entryModel.setData(index, "read", 1, "");
}
}
function navigateBack() {
@ -136,7 +141,6 @@ Page {
}
function openEntryInBrowser() {
entryModel.setData(index, "read", 1, "");
notification.show(qsTr("Launching an external browser..."));
//Qt.openUrlExternally(settings.offlineMode ? offlineUrl : onlineUrl);
Qt.openUrlExternally(onlineUrl)
@ -159,7 +163,8 @@ Page {
"index": index,
"feedindex": feedindex,
"read" : read,
"cached" : cached
"cached" : cached,
"autoRead" : autoRead
});
}
@ -377,6 +382,7 @@ Page {
text: qsTr("Toggle Read")
icon: root.read ? "image://icons/icon-m-read-selected" : "image://icons/icon-m-read"
onClicked: {
root.autoRead=false;
if (root.read) {
root.read=false;
entryModel.setData(root.index, "read", 0, "");

View file

@ -41,6 +41,7 @@ Page {
ActiveDetector {
onActivated: {
tabModel.updateFlags()
bar.flick = listView
}
onInit: {
bar.flick = listView

View file

@ -49,6 +49,7 @@ Page {
property bool readerModePossible: false
property bool nightModePossible: true
property bool autoReaderMode: settings.readerMode
property bool autoRead: true
function share() {
pageStack.push(Qt.resolvedUrl("ShareLinkPage.qml"),{"link": root.onlineUrl, "linkTitle": root.title});
@ -263,7 +264,7 @@ Page {
proggressPanel.open = false;
// Start timer to mark as read
if (!root.read)
if (!root.read && root.autoRead)
timer.start();
// Readability.js

View file

@ -227,11 +227,8 @@ QString Utils::formatHtml(const QString & data, bool offline, const QString & st
QRegExp rxA("<a[^>]*></a>", Qt::CaseInsensitive);
QRegExp rxP("<p[^>]*></p>", Qt::CaseInsensitive);
QTextDocument doc; doc.setHtml(data);
if (doc.toPlainText().replace(QChar::ObjectReplacementCharacter,QChar(0x0020)).trimmed().isEmpty())
return "";
QString content = data;
content.remove(rxTarget);
if (offline) {
content.remove(rxImg); content.remove("</img>", Qt::CaseInsensitive);