Warning, /plasma-mobile/mycroft-plasmoid-mobile/plasmoid/contents/ui/DocumentFileDelegate.qml is written in an unsupported language. File is not indexed.
0001 /* Copyright 2016 Aditya Mehra <aix.m@outlook.com>
0002
0003 This library is free software; you can redistribute it and/or
0004 modify it under the terms of the GNU Lesser General Public
0005 License as published by the Free Software Foundation; either
0006 version 2.1 of the License, or (at your option) version 3, or any
0007 later version accepted by the membership of KDE e.V. (or its
0008 successor approved by the membership of KDE e.V.), which shall
0009 act as a proxy defined in Section 6 of version 3 of the license.
0010
0011 This library is distributed in the hope that it will be useful,
0012 but WITHOUT ANY WARRANTY; without even the implied warranty of
0013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0014 Lesser General Public License for more details.
0015
0016 You should have received a copy of the GNU Lesser General Public
0017 License along with this library. If not, see <http://www.gnu.org/licenses/>.
0018 */
0019
0020 import QtQuick 2.9
0021 import QtQml.Models 2.2
0022 import QtMultimedia 5.8
0023 import QtQuick.Controls 2.2
0024 import QtQuick.Layouts 1.3
0025 import org.kde.plasma.core 2.0 as PlasmaCore
0026 import org.kde.plasma.plasmoid 2.0
0027 import org.kde.plasma.components 2.0 as PlasmaComponents
0028
0029 Rectangle {
0030 id: documentFileDelegateItm
0031 implicitHeight: documentFileDelegateInner.height
0032 color: Qt.darker(theme.backgroundColor, 1.2)
0033 width: cbwidth
0034
0035 Item {
0036 id: documentFileDelegateInner
0037 implicitHeight: Math.max(documentInnerInfoColumn.height, playDocumentBtn.height + units.gridUnit * 1)
0038 width: parent.width
0039
0040 PlasmaCore.IconItem {
0041 id: documentImgType
0042 source: "document-new"
0043 anchors.left: parent.left
0044 width: units.gridUnit * 1
0045 height: units.gridUnit * 1
0046 anchors.verticalCenter: parent.verticalCenter
0047 }
0048
0049 Item {
0050 id: documentInnerInfoColumn
0051 implicitHeight: documentFileName.implicitHeight + sprTrinnerDocument.height + documentFileLoc.implicitHeight + units.gridUnit * 0.50
0052 anchors.left: documentImgType.right
0053 anchors.leftMargin: units.gridUnit * 0.30
0054 anchors.right: playDocumentBtn.left
0055 anchors.rightMargin: units.gridUnit * 0.30
0056
0057 PlasmaComponents.Label {
0058 id: documentFileName
0059 color: theme.textColor
0060 anchors.left: parent.left
0061 anchors.right: parent.right
0062 anchors.top: parent.top
0063 anchors.topMargin: units.gridUnit * 0.25
0064 wrapMode: Text.Wrap
0065
0066 Component.onCompleted: {
0067 var filterName = InputQuery.toString();
0068 documentFileName.text = filterName.match(/\/([^\/]+)\/?$/)[1]
0069 }
0070 }
0071
0072 Rectangle {
0073 id: sprTrinnerDocument
0074 anchors.left: parent.left
0075 anchors.right: parent.right
0076 anchors.rightMargin: units.gridUnit * 1
0077 anchors.top: documentFileName.bottom
0078 anchors.topMargin: units.gridUnit * 0.15
0079 color: theme.linkColor
0080 height: units.gridUnit * 0.1
0081 }
0082
0083 PlasmaComponents.Label {
0084 id: documentFileLoc
0085 color: theme.linkColor
0086 font.pointSize: 9
0087 anchors.left: parent.left
0088 anchors.right: parent.right
0089 anchors.top: sprTrinnerDocument.bottom
0090
0091 wrapMode: Text.Wrap
0092 Component.onCompleted: {
0093 documentFileLoc.text = "<i>Location: " + InputQuery + "</i>"
0094 }
0095 }
0096 }
0097
0098 PlasmaComponents.Button {
0099 id: playDocumentBtn
0100 anchors.right: parent.right
0101 anchors.rightMargin: units.gridUnit * 0.75
0102 anchors.verticalCenter: parent.verticalCenter
0103 width: units.gridUnit * 3.5
0104 height: units.gridUnit * 3
0105 text: i18n("Open")
0106
0107 onClicked: {
0108 var docFile = Qt.resolvedUrl(InputQuery)
0109 Qt.openUrlExternally(docFile)
0110 }
0111 }
0112 }
0113 }