Warning, /system/apper/plasmoid/package/contents/ui/ChangelogView.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 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.components 0.1 as PlasmaComponents 0020 import org.kde.apper 0.1 as Apper 0021 0022 Item { 0023 id: changelogItem 0024 state: "FETCHING" 0025 width: parent.width 0026 0027 property string updatesList: "" 0028 0029 function transactionFinished() { 0030 if (changelogItem.state != "DETAILS") { 0031 statusView.title = i18n("Failed to get update details"); 0032 if (transaction.internalErrorMessage !== undefined) { 0033 statusView.subTitle = transaction.internalErrorMessage; 0034 } 0035 changelogItem.state = "ERROR"; 0036 } 0037 } 0038 0039 Apper.PkTransaction { 0040 id: transaction 0041 onUpdateDetail: { 0042 for (var count = 0; count < updates.length; ++count) { 0043 if (updatesList.length) { 0044 updatesList += ", " 0045 } 0046 updatesList += Daemon.packageName(updates[count]) + " - " + Daemon.packageVersion(updates[count]); 0047 } 0048 0049 if (updateText === "" || updateText === undefined) { 0050 if (changelog !== "" && changelog !== undefined) { 0051 changelogText.text = changelog; 0052 } 0053 } else { 0054 changelogText.text = updateText; 0055 } 0056 changelogItem.state = "DETAILS"; 0057 } 0058 } 0059 0060 StatusView { 0061 id: busyView 0062 opacity: 0 0063 anchors.left: parent.left 0064 anchors.right: parent.right 0065 anchors.verticalCenter: parent.verticalCenter 0066 state: "BUSY" 0067 iconSize: 32 0068 title: PkStrings.action(transaction.role, transaction.transactionFlags) 0069 subTitle: PkStrings.status(transaction.status) 0070 } 0071 0072 StatusView { 0073 id: statusView 0074 opacity: 0 0075 anchors.left: parent.left 0076 anchors.right: parent.right 0077 anchors.verticalCenter: parent.verticalCenter 0078 iconSize: 32 0079 iconName: "dialog-error" 0080 } 0081 0082 Column { 0083 id: detailsColumn 0084 opacity: 0 0085 spacing: 2 0086 anchors.left: parent.left 0087 anchors.top: parent.top 0088 anchors.right: parent.right 0089 anchors.leftMargin: updateCB.width 0090 PlasmaComponents.Label { 0091 id: updateVersion 0092 width: parent.width 0093 wrapMode: Text.Wrap 0094 text: i18n("Version: %1", rVersion) 0095 } 0096 PlasmaComponents.Label { 0097 id: updatesText 0098 width: parent.width 0099 wrapMode: Text.Wrap 0100 text: i18n("Updates: %1", updatesList) 0101 } 0102 PlasmaComponents.Label { 0103 id: changelogText 0104 width: parent.width 0105 wrapMode: Text.Wrap 0106 } 0107 } 0108 0109 states: [ 0110 State { 0111 name: "FETCHING" 0112 PropertyChanges { target: busyView; opacity: 1 } 0113 PropertyChanges { target: changelogItem; height: busyView.preferedHeight } 0114 }, 0115 State { 0116 name: "ERROR" 0117 PropertyChanges { target: statusView; opacity: 1 } 0118 PropertyChanges { target: changelogItem; height: statusView.preferedHeight } 0119 }, 0120 State { 0121 name: "DETAILS" 0122 PropertyChanges { target: detailsColumn; opacity: 1 } 0123 PropertyChanges { target: changelogItem; height: detailsColumn.height } 0124 } 0125 ] 0126 0127 transitions: Transition { 0128 NumberAnimation { properties: "opacity"; easing.type: Easing.InOutQuad } 0129 } 0130 0131 Component.onCompleted: { 0132 transaction.finished.connect(transactionFinished); 0133 transaction.getUpdateDetail(rId); 0134 var error = transaction.internalError; 0135 if (error) { 0136 statusView.title = PkStrings.daemonError(error); 0137 if (transaction.internalErrorMessage !== undefined) { 0138 statusView.subTitle = transaction.internalErrorMessage; 0139 } 0140 changelogItem.state = "ERROR"; 0141 } 0142 } 0143 }