I am trying to make a KDE Wallpaper Plugin. The QML code works fine. But when I try to connect a js script, even without invoking any functions the wallpaper plugin doesn't work.
QML Code:
import QtQuick 2.1
import QtQuick.Layouts 1.1
import org.kde.plasma.core 2.0
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
import "datecompare.js" as decider
import org.kde.plasma.private.konbanwa 1.0
Item {
id: root
Rectangle {
id: backgroundRect
anchors.fill: parent
Image{
id: backgroundImage
height: parent.height
width: parent.width
fillMode: Image.PreserveAspectCrop
source: decider.deciding()
}
}
}
JS Code:
.pragma library
var today = new Date();
var syshour = today.getHours();
var sysminutes = today.getMinutes();
var usertimehour = 17;
var usertimeminutes = 50;
function deciding () {
if (syshour >= usertimehour) {
if (sysminutes>= usertimeminutes) {
return "img/night2.png";
}
if (sysminutes < usertimeminutes){
return "img/day.jpg";
}
}
else {
return "img/day.jpg";
}
}
I checked by myself several times but since I am beginner to javascript, it could be a small mistake that I oversaw. If its done wrong, how can I do it?