diff --git a/plasmoid/contents/ui/MsmView.qml b/plasmoid/contents/ui/MsmView.qml index 10d5357..4c1aeeb 100644 --- a/plasmoid/contents/ui/MsmView.qml +++ b/plasmoid/contents/ui/MsmView.qml @@ -1,112 +1,112 @@ /* Copyright 2019 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 QtQuick.Layouts 1.3 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.components 3.0 as PlasmaComponents3 import org.kde.plasma.extras 2.0 as PlasmaExtras import QtGraphicalEffects 1.0 import org.kde.kirigami 2.5 as Kirigami import Mycroft 1.0 as Mycroft Kirigami.AbstractCard { id: skillInstallerDelegate contentItem: Item { implicitWidth: delegateLayout.implicitWidth; implicitHeight: delegateLayout.implicitHeight; ColumnLayout{ id: delegateLayout anchors { left: parent.left; top: parent.top; right: parent.right; } Kirigami.Heading { id: skillName Layout.fillWidth: true; wrapMode: Text.WordWrap; font.bold: true; text: qsTr(model.name); level: 3; color: Kirigami.Theme.textColor; } RowLayout { id: skillInfoRow spacing: Kirigami.Units.largeSpacing Layout.fillWidth: true PlasmaCore.IconItem { id: innerskImg source: "download"; Layout.preferredWidth: innerskImg.width Layout.preferredHeight: innerskImg.height width: Kirigami.Units.gridUnit * 2 height: Kirigami.Units.gridUnit * 2 } Label { id: skillURL wrapMode: Text.WordWrap color: theme.textColor text: "View Repository" Layout.fillWidth: true; MouseArea{ id: gotoGit anchors.fill: parent hoverEnabled: true onClicked: {Qt.openUrlExternally(model.url)} onEntered: { skillURL.color = Qt.darker(theme.linkColor, 1.2) } onExited: { skillURL.color = theme.textColor } } } } PlasmaComponents.Button{ id: actionItem text: "Install" Layout.fillWidth: true onClicked:{ switch(actionItem.text){ case "Install": - Mycroft.MycroftController.sendText("install" + skillName) + Mycroft.MycroftController.sendText("install " + skillName.text) break case "Uninstall": var msmprogress = execUninstall() break } } } } } } diff --git a/plasmoid/contents/ui/SkillsInstallerComponent.qml b/plasmoid/contents/ui/SkillsInstallerComponent.qml index 28c18d5..fdb51f6 100644 --- a/plasmoid/contents/ui/SkillsInstallerComponent.qml +++ b/plasmoid/contents/ui/SkillsInstallerComponent.qml @@ -1,164 +1,164 @@ /* Copyright 2019 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 QtQuick.Layouts 1.3 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.components 2.0 as PlasmaComponents import org.kde.plasma.components 3.0 as PlasmaComponents3 import org.kde.plasma.extras 2.0 as PlasmaExtras import QtGraphicalEffects 1.0 import org.kde.kirigami 2.5 as Kirigami import Mycroft 1.0 as Mycroft Rectangle { id: skillsInstallerComponent Layout.fillWidth: true Layout.fillHeight: true color: Kirigami.Theme.backgroundColor property var skillList: [] function refreshAllSkills(){ getSkills(); msmskillsModel.reload(); } function getAllSkills(){ if(skillList.length <= 0){ getSkills(); } return skillList; } function getSkillByName(skillName){ var tempSN=[]; for(var i = 0; i 0 ) { msmskillsModel.applyFilter(text.toLowerCase()); } else { msmskillsModel.reload(); } } } PlasmaComponents.ToolButton { id: getskillsbx anchors.right: parent.right anchors.top: parent.top anchors.bottom: parent.bottom iconSource: "view-refresh" tooltip: i18n("Refresh List") flat: true width: Math.round(units.gridUnit * 2) height: width z: 102 onClicked: { msmskillsModel.clear(); refreshAllSkills(); } } } ListModel { id: msmskillsModel Component.onCompleted: { reload(); } function reload() { var skList = getAllSkills(); msmskillsModel.clear(); for( var i=0; i < skList.length ; ++i ) { msmskillsModel.append(skList[i]); } } function applyFilter(skName) { var skList = getSkillByName(skName); msmskillsModel.clear(); for( var i=0; i < skList.length ; ++i ) { msmskillsModel.append(skList[i]); } } } Kirigami.CardsListView { id: msmlistView anchors.top: msmtabtopbar.bottom anchors.topMargin: Kirigami.Units.largeSpacing anchors.left: parent.left anchors.right: parent.right anchors.bottom: parent.bottom model: msmskillsModel delegate: MsmView{} clip: true; } }