diff --git a/plasmoid/contents/ui/LoaderType.qml b/plasmoid/contents/ui/LoaderType.qml new file mode 100755 --- /dev/null +++ b/plasmoid/contents/ui/LoaderType.qml @@ -0,0 +1,81 @@ +/* Copyright 2016 Aditya Mehra + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) version 3, or any + later version accepted by the membership of KDE e.V. (or its + successor approved by the membership of KDE e.V.), which shall + act as a proxy defined in Section 6 of version 3 of the license. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library. If not, see . +*/ + +import QtQuick 2.9 +import QtQml.Models 2.2 +import QtQuick.Controls 2.2 +import org.kde.plasma.components 2.0 as PlasmaComponents +import org.kde.plasma.extras 2.0 as PlasmaExtras +import org.kde.private.mycroftplasmoid 1.0 as PlasmaLa + +Column { + spacing: 6 + anchors.right: parent.right + property string filename: "file:///" + model.InputQuery + property int getHeight + + Component.onCompleted: { + var mObj = loaderComp.createObject(loaderView, {}) + } + + Row { + id: messageRow + spacing: 6 + + Rectangle { + id: messageRect + width: cbwidth + radius: 2 + height: newikiFlick.height + color: theme.backgroundColor + + Flickable { + id: newikiFlick + width: messageRect.width + height: getHeight + + Item { + id: loaderView + anchors.fill: parent + } + + Component { + id: loaderComp + + Loader { + id: loaderScreen + anchors.left: parent.left + anchors.right: parent.right + height: Math.max(item ? item.implicitHeight : 0, units.gridUnit * 10) + source: filename + + function reload(){ + source = filename + "?t=" + Date.now() + } + + Component.onCompleted: { + loaderScreen.reload(); + getHeight = height + } + } + } + } + } + } + } diff --git a/plasmoid/contents/ui/main.qml b/plasmoid/contents/ui/main.qml --- a/plasmoid/contents/ui/main.qml +++ b/plasmoid/contents/ui/main.qml @@ -121,6 +121,12 @@ } } + function filtervisualObj(metadata){ + convoLmodel.append({"itemType": "LoaderType", "InputQuery": metadata.url}) + inputlistView.positionViewAtEnd(); + } + + function isBottomEdge() { return plasmoid.location == PlasmaCore.Types.BottomEdge; } @@ -216,6 +222,10 @@ waitanimoutter.cstanim.visible = false waitanimoutter.cstanim.running = false break + case "mycroft.skill.handler.complete": + drawer.close() + waitanimoutter.cstanim.running = false + break } } @@ -486,10 +496,15 @@ filterSpeak(somestring.data.utterance); } - if(somestring && somestring.data && typeof somestring.data.desktop !== 'undefined') { + if(somestring && somestring.data && typeof somestring.data.desktop !== 'undefined' && somestring.type === "data") { dataContent = somestring.data.desktop filterincoming(smintent, dataContent) } + + if(somestring && somestring.data && typeof somestring.data.desktop !== 'undefined' && somestring.type === "visualObject") { + dataContent = somestring.data.desktop + filtervisualObj(dataContent) + } if (msgType === "speak" && !plasmoid.expanded && notificationswitch.checked == true) { var post = somestring.data.utterance; @@ -717,6 +732,7 @@ case "CurrentWeather": return "CurrentWeatherType.qml" case "DropImg" : return "ImgRecogType.qml" case "AskType" : return "AskMessageType.qml" + case "LoaderType" : return "LoaderType.qml" } property var metacontent : dataContent }