Warning, /system/apper/plasmoid/package/contents/ui/TransactionProgressDelegate.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *   Copyright 2012 Daniel Nicoletti <dantti12@gmail.com>
0003  *
0004  *   This program is free software; you can redistribute it and/or modify
0005  *   it under the terms of the GNU Library General Public License as
0006  *   published by the Free Software Foundation; either version 2 or
0007  *   (at your option) any later version.
0008  *
0009  *   This program is distributed in the hope that it will be useful,
0010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012  *   GNU General Public License for more details
0013  *
0014  *   You should have received a copy of the GNU Library General Public
0015  *   License along with this program; if not, write to the
0016  *   Free Software Foundation, Inc.,
0017  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
0018  */
0019 
0020 import QtQuick 1.1
0021 import org.kde.plasma.core 0.1 as PlasmaCore
0022 import org.kde.plasma.components 0.1 as PlasmaComponents
0023 import org.kde.qtextracomponents 0.1
0024 
0025 Item {
0026     id: delegateItem
0027     width: ListView.view.width
0028     height: line.height
0029     state: rRepo ? "REPO" : "PACKAGE"
0030 
0031     Row {
0032         id: line
0033         spacing: 4
0034         anchors.centerIn: parent
0035         anchors.leftMargin: 2
0036         anchors.rightMargin: 2
0037         width: parent.width
0038         PlasmaComponents.ProgressBar {
0039             id: itemProgress
0040             width: progressWidth
0041             height: itemStatusLabel.paintedHeight + 4
0042             minimumValue: 0
0043             maximumValue: 100
0044             PlasmaComponents.Label {
0045                 // 12 = 3 * spacing
0046                 id: itemStatusLabel
0047                 anchors.centerIn: parent
0048                 onPaintedWidthChanged: {
0049                     if (progressWidth < paintedWidth) {
0050                         progressWidth = paintedWidth + 8;
0051                     }
0052                 }
0053             }
0054         }
0055         PlasmaComponents.Label {
0056             id: itemNameLabel
0057             anchors.verticalCenter: parent.verticalCenter
0058             height: paintedHeight
0059             width: paintedWidth
0060         }
0061         PlasmaComponents.Label {
0062             id: itemSummaryLabel
0063             anchors.verticalCenter: parent.verticalCenter
0064             height: paintedHeight
0065             width: line.width - itemProgress.width - itemNameLabel.width - 8
0066             color: "#99"+(theme.textColor.toString().substr(1))
0067             elide: Text.ElideRight
0068         }
0069     }
0070 
0071     PlasmaComponents.Label {
0072         id: repoLabel
0073         anchors.centerIn: parent
0074         anchors.leftMargin: 2
0075         anchors.rightMargin: 2
0076         width: parent.width
0077         height: parent.height
0078         elide: Text.ElideRight
0079     }
0080 
0081     states: [
0082         State {
0083             name: "REPO"
0084             PropertyChanges { target: line; opacity: 0 }
0085             PropertyChanges { target: repoLabel; text: display }
0086         },
0087         State {
0088             name: "PACKAGE"
0089             PropertyChanges { target: repoLabel; opacity: 0 }
0090             PropertyChanges { target: itemProgress; value: rProgress }
0091             PropertyChanges { target: itemStatusLabel; text: display }
0092             PropertyChanges { target: itemNameLabel; text: rPkgName }
0093             PropertyChanges { target: itemSummaryLabel; text: rPkgSummary }
0094         }
0095     ]
0096 }