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

0001 /*
0002  * Copyright 2012-2013  Daniel Nicoletti <dantti12@gmail.com>
0003  *
0004  * This program is free software; you can redistribute it and/or
0005  * modify it under the terms of the GNU General Public License as
0006  * published by the Free Software Foundation; either version 2 of
0007  * the License, or (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 General Public License
0015  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
0016  */
0017 
0018 import QtQuick 1.1
0019 import org.kde.plasma.core 0.1 as PlasmaCore
0020 import org.kde.plasma.components 0.1 as PlasmaComponents
0021 import org.kde.apper 0.1 as Apper
0022 
0023 FocusScope {
0024     id: updates
0025 
0026     anchors.fill: parent
0027     clip: true
0028 
0029     property alias sortModel: appModel
0030     signal updateClicked()
0031 
0032     function modelChanged() {
0033         updateAllCB.checked = updatesModel.allSelected();
0034         // Enable the update button if there are packages to install
0035         updateBT.enabled = updatesModel.selectedPackagesToInstall().length;
0036     }
0037 
0038     PlasmaCore.FrameSvgItem {
0039         id: padding
0040         imagePath: "widgets/viewitem"
0041         prefix: "hover"
0042         visible: false
0043     }
0044 
0045     Apper.ApplicationSortFilterModel {
0046         id: appModel
0047         sourcePkgModel: updatesModel
0048     }
0049 
0050     Column {
0051         spacing: 4
0052         anchors.fill: parent
0053 
0054         Row {
0055             id: headerRow
0056             spacing: 4
0057             // This margin is to align with the updates list check boxes
0058             anchors.leftMargin: padding.margins.left
0059             anchors.left: parent.left
0060             anchors.right: parent.right
0061             PlasmaComponents.CheckBox {
0062                 id: updateAllCB
0063                 anchors.verticalCenter: parent.verticalCenter
0064                 height: width
0065                 onClicked: updatesModel.setAllChecked(checked);
0066                 KeyNavigation.tab: updateBT
0067                 KeyNavigation.backtab: updatesView
0068             }
0069             PlasmaComponents.Label {
0070                 anchors.verticalCenter: parent.verticalCenter
0071                 width: parent.width - updateAllCB.width - updateBT.width - parent.spacing * 2
0072                 horizontalAlignment: Text.AlignLeft
0073                 text: updatesModel.selectionStateText
0074             }
0075             PlasmaComponents.Button {
0076                 id: updateBT
0077                 focus: true
0078                 anchors.verticalCenter: parent.verticalCenter
0079                 text:  i18n("Install")
0080                 KeyNavigation.tab: updatesView
0081                 KeyNavigation.backtab: updateAllCB
0082             }
0083         }
0084 
0085         PlasmaCore.SvgItem {
0086             id: headerSeparator
0087             svg: PlasmaCore.Svg {
0088                 id: lineSvg
0089                 imagePath: "widgets/line"
0090             }
0091             elementId: "horizontal-line"
0092             height: lineSvg.elementSize("horizontal-line").height
0093             width: parent.width
0094         }
0095 
0096         ScrollableListView {
0097             id: updatesView
0098             height: parent.height - headerRow.height - parent.spacing * 2
0099             anchors.left: parent.left
0100             anchors.right: parent.right
0101             delegate: UpdateItemDelegate {
0102             }
0103             view.currentIndex: -1
0104             model: appModel
0105             KeyNavigation.tab: updateAllCB
0106             KeyNavigation.backtab: updateBT
0107         }
0108     }
0109 
0110     Component.onCompleted: {
0111         updatesModel.changed.connect(modelChanged);
0112         updateBT.clicked.connect(updateClicked);
0113     }
0114 }