-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Ported Andreas Loos's version to Plasma 6. * Incorporated some improvements from Mircea Kitsune. * Fixed wrapping of titles. * Improved theme support. * Enriched the context menu.
- Loading branch information
0 parents
commit 16abff7
Showing
10 changed files
with
704 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
v0.4 | ||
* Ported Andreas Loos's version to Plasma 6. | ||
* Incorporated some improvements from Mircea Kitsune. | ||
* Fixed wrapping of titles. | ||
* Improved theme support. | ||
* Enriched the context menu. |
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* @liujed |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# RSS feed widget for KDE Plasma 6 | ||
|
||
A barebones widget for displaying an RSS feed. Shows the title, timestamp, and | ||
description (without images) of each feed item. Clicking on a feed item opens | ||
its link in the default browser. | ||
|
||
Rescued and adapted for Plasma 6. This was originally written by Andreas Loos, | ||
2015, and includes selected contributions from Mircea Kitsune, 2017-2018. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import QtQuick 2.15 | ||
import org.kde.plasma.configuration | ||
|
||
ConfigModel { | ||
ConfigCategory { | ||
name: i18n("General") | ||
icon: 'preferences-system-windows' | ||
source: 'config/ConfigGeneral.qml' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 | ||
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" > | ||
<kcfgfile name=""/> | ||
|
||
<group name="General"> | ||
<entry name="refresh" type="Int"> | ||
<default>300</default> | ||
</entry> | ||
<entry name="url" type="String"> | ||
<default>https://dot.kde.org/rss.xml</default> | ||
</entry> | ||
<entry name="headerColor" type="String"> | ||
<default>#4682b4</default> | ||
</entry> | ||
<entry name="listOpacity" type="Int"> | ||
<default>80</default> | ||
</entry> | ||
</group> | ||
|
||
</kcfg> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,189 @@ | ||
import QtQuick 2.15 | ||
import QtQml.XmlListModel | ||
import QtQuick.Controls | ||
|
||
import org.kde.plasma.core as PlasmaCore | ||
import org.kde.plasma.plasmoid | ||
|
||
Item { | ||
id: window | ||
width: 300 | ||
height: 500 | ||
|
||
property var url: plasmoid.configuration.url | ||
property int refresh: 1000 * plasmoid.configuration.refresh | ||
property var headerColor: plasmoid.configuration.headerColor | ||
property var listOpacity: plasmoid.configuration.listOpacity | ||
|
||
function stripString (str) { | ||
var regex = /(<img.*?>)/gi; | ||
str = str.replace(regex, ""); | ||
regex = /ä/gi; | ||
str = str.replace(regex, "ä"); | ||
regex = /ö/gi; | ||
str = str.replace(regex, "ö"); | ||
regex = /ü/gi; | ||
str = str.replace(regex, "ü"); | ||
regex = /Ä/gi; | ||
str = str.replace(regex, "Ä"); | ||
regex = /Ö/gi; | ||
str = str.replace(regex, "Ö"); | ||
regex = /Ü/gi; | ||
str = str.replace(regex, "Ü"); | ||
regex = /ß/gi; | ||
str = str.replace(regex, "ß"); | ||
|
||
return str; | ||
} | ||
|
||
XmlListModel { | ||
id: xmlModel | ||
source: url | ||
query: "/rss/channel/item" | ||
|
||
XmlListModelRole { name: "title"; elementName: "title" } | ||
XmlListModelRole { name: "pubDate"; elementName: "pubDate" } | ||
XmlListModelRole { name: "description"; elementName: "description" } | ||
XmlListModelRole { name: "link"; elementName: "link" } | ||
|
||
onStatusChanged: busyIndicator.running = true | ||
} | ||
|
||
Component { | ||
id: feedDelegate | ||
Rectangle { | ||
height: layout.height | ||
width: thefeed.width | ||
color: PlasmaCore.Theme.viewBackgroundColor | ||
Component.onCompleted: busyIndicator.running = false | ||
|
||
Item { | ||
height: layout.height | ||
width: thefeed.width | ||
|
||
Column { | ||
id: layout | ||
Row { | ||
Text { | ||
width: thefeed.width | ||
wrapMode: Text.WordWrap | ||
font.pixelSize: 12 | ||
color: PlasmaCore.Theme.textColor | ||
font.bold: true | ||
text: title | ||
} | ||
} | ||
Row { | ||
Text { | ||
width: thefeed.width | ||
wrapMode: Text.WordWrap | ||
font.pixelSize: 9 | ||
color: headerColor | ||
font.bold: false | ||
text: pubDate | ||
} | ||
} | ||
Row { | ||
Text { | ||
width: thefeed.width | ||
wrapMode: Text.WordWrap | ||
font.pixelSize: 12 | ||
color: PlasmaCore.Theme.textColor | ||
font.bold: false | ||
text: stripString(description) | ||
} | ||
} | ||
Row { | ||
Rectangle { | ||
width: thefeed.width | ||
color: PlasmaCore.Theme.textColor | ||
height: 1 | ||
} | ||
} | ||
} | ||
|
||
MouseArea { | ||
acceptedButtons: Qt.LeftButton | ||
anchors.fill: parent | ||
onClicked: { | ||
Qt.openUrlExternally(link) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
Component { | ||
id: header | ||
Rectangle { | ||
width: thefeed.width | ||
height: 19 | ||
color: PlasmaCore.Theme.viewBackgroundColor | ||
Item { | ||
width: thefeed.width | ||
height: 19 | ||
Text { | ||
horizontalAlignment: Text.AlignRight | ||
width: thefeed.width | ||
height: 8 | ||
font.pixelSize: 9 | ||
text: url | ||
color: headerColor | ||
} | ||
|
||
Rectangle { | ||
y: 11 | ||
width: thefeed.width | ||
height: 8 | ||
color: headerColor | ||
} | ||
} | ||
} | ||
} | ||
|
||
Component { | ||
id: footer | ||
Rectangle { | ||
width: thefeed.width | ||
height: 8 | ||
color: headerColor | ||
} | ||
} | ||
|
||
ListView { | ||
id: thefeed | ||
opacity: listOpacity / 100 | ||
maximumFlickVelocity: 2500 | ||
clip: true | ||
width: parent.width-20 | ||
anchors.fill: parent | ||
spacing: 2 | ||
model: xmlModel | ||
delegate: feedDelegate | ||
header: header | ||
footer: footer | ||
snapMode: ListView.SnapToItem | ||
} | ||
|
||
BusyIndicator { | ||
id: busyIndicator | ||
running: true | ||
anchors.centerIn: parent | ||
} | ||
|
||
Timer { | ||
id: refreshTimer | ||
interval: refresh | ||
running: true | ||
repeat: true | ||
onTriggered: { xmlModel.reload() } | ||
} | ||
|
||
Plasmoid.contextualActions: [ | ||
PlasmaCore.Action { | ||
text: i18n("Refresh") | ||
icon.name: "view-refresh" | ||
onTriggered: xmlModel.reload() | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import QtQuick 2.15 | ||
import QtQuick.Controls | ||
import QtQuick.Layouts | ||
import QtQuick.Dialogs | ||
|
||
Item { | ||
property alias cfg_refresh: refresh.value | ||
property alias cfg_url: url.text | ||
property alias cfg_headerColor: headerColorDialog.selectedColor | ||
property alias cfg_listOpacity: listOpacity.value | ||
|
||
GridLayout { | ||
id: generalConfig | ||
Layout.fillWidth: true | ||
rowSpacing: 10 | ||
columnSpacing: 10 | ||
columns: 2 | ||
|
||
Text { | ||
text: "Reload time (seconds)" | ||
} | ||
SpinBox { | ||
id: refresh | ||
from: 1 | ||
to: 1800 | ||
} | ||
Text { | ||
text: "URL" | ||
} | ||
TextField { | ||
id: url | ||
Layout.fillWidth: true | ||
Layout.minimumWidth: 400 | ||
placeholderText: "http://www.faz.net/rss/aktuell/" | ||
} | ||
|
||
Text { | ||
text: "Header Color" | ||
} | ||
Rectangle { | ||
id: headerColor | ||
width: 50 | ||
height: 17 | ||
color: headerColorDialog.selectedColor | ||
border.color: "black" | ||
border.width: 1 | ||
radius: 0 | ||
MouseArea{ | ||
anchors.fill: parent | ||
onClicked: { headerColorDialog.open() } | ||
} | ||
} | ||
|
||
Text { | ||
text: "Opacity" | ||
} | ||
SpinBox { | ||
id: listOpacity | ||
from: decimalToInt(0) | ||
to: decimalToInt(1) | ||
value: decimalToInt(0.85) | ||
stepSize: decimalToInt(0.05) | ||
|
||
property int decimals: 2 | ||
property real realValue: value / decimalFactor | ||
readonly property int decimalFactor: Math.pow(10, decimals) | ||
|
||
function decimalToInt(decimal) { | ||
return decimal * decimalFactor | ||
} | ||
|
||
validator: DoubleValidator { | ||
bottom: listOpacity.from | ||
top: listOpacity.to | ||
decimals: listOpacity.decimals | ||
notation: DoubleValidator.StandardNotation | ||
} | ||
|
||
textFromValue: function(value, locale) { | ||
return Number(value / decimalFactor).toLocaleString(locale, 'f', decimals) | ||
} | ||
|
||
valueFromText: function(value, locale) { | ||
return Math.round(Number.fromLocaleString(locale, text) * decimalFactor) | ||
} | ||
} | ||
} | ||
|
||
ColorDialog { | ||
id: headerColorDialog | ||
title: "Please choose a header color" | ||
selectedColor: "Steel Blue" | ||
onAccepted: headerColor.color = selectedColor | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import QtQuick 2.15 | ||
import org.kde.plasma.plasmoid | ||
|
||
PlasmoidItem { | ||
id: main | ||
fullRepresentation: FullRepresentation { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"KPackageStructure": "Plasma/Applet", | ||
"KPlugin": { | ||
"Authors": [ | ||
{ | ||
"Name": "Jed Liu" | ||
}, | ||
{ | ||
"Name": "Mircea Kitsune" | ||
}, | ||
{ | ||
"Name": "Andreas Loos" | ||
} | ||
], | ||
"Category": "Online Services", | ||
"Description": "RSS feed reader", | ||
"Icon": "rss", | ||
"Id": "com.github.liujed.rssfeeds", | ||
"Name": "RSS feeds", | ||
"Version": "0.4", | ||
"License": "GPL2", | ||
"Website": "https://github.com/liujed/plasma-applet-rss-feeds" | ||
}, | ||
"X-Plasma-API-Minimum-Version": "6.0" | ||
} |