Commit c0372aec authored by Nate Graham's avatar Nate Graham
Browse files

Improve UI of proceed sheet

Right now if the text is really long, it gets elided at the bottom so
you need to click a button to see the rest, and the two distinct
sections of the text are kind of unclear.

This commit puts the text in the sheet's own scrollview so you can scroll
immediately, and adds a line break between the sections. It also puts the
bottom buttons in a footer, which looks better.

BUG: 419341
FIXED-IN: 5.20
parent 8d97115e
import QtQuick 2.5
import QtQuick.Layouts 1.1
import QtQuick.Controls 2.1
import QtQuick.Controls 2.14
import org.kde.discover 2.0
import org.kde.discover.app 1.0
import org.kde.kquickcontrolsaddons 2.0
......@@ -199,58 +199,51 @@ Kirigami.ApplicationWindow
wrapMode: Text.WordWrap
}
ColumnLayout {
// No need to add our own ScrollView since OverlaySheet includes
// one automatically.
// But we do need to put the label into a Layout of some sort so we
// can limit the width of the sheet.
contentItem: ColumnLayout {
Label {
id: desc
Layout.fillWidth: true
Layout.maximumHeight: clip ? window.height * 0.5 : implicitHeight
clip: true
Layout.maximumWidth: Kirigami.Units.gridUnit * 30
textFormat: Text.StyledText
wrapMode: Text.WordWrap
}
}
footer: RowLayout {
Item { Layout.fillWidth : true }
readonly property var bottomShadow: Shadow {
parent: desc
anchors {
right: parent.right
left: parent.left
bottom: parent.bottom
}
visible: desc.clip
edge: Qt.BottomEdge
height: desc.height * 0.01
Button {
text: i18n("Proceed")
icon.name: "dialog-ok"
onClicked: {
transaction.proceed()
sheet.acted = true
sheet.close()
}
Keys.onEnterPressed: clicked()
Keys.onReturnPressed: clicked()
}
Button {
text: desc.clip ? i18n("Show all") : i18n("Hide")
onClicked: desc.clip = !desc.clip
visible: window.height * 0.5 < desc.implicitHeight
}
RowLayout {
Layout.alignment: Qt.AlignRight
Button {
text: i18n("Proceed")
icon.name: "dialog-ok"
onClicked: {
transaction.proceed()
sheet.acted = true
sheet.close()
}
Keys.onEnterPressed: clicked()
Keys.onReturnPressed: clicked()
}
Button {
Layout.alignment: Qt.AlignRight
text: i18n("Cancel")
icon.name: "dialog-cancel"
onClicked: {
transaction.cancel()
sheet.acted = true
sheet.close()
}
Keys.onEscapePressed: clicked()
text: i18n("Cancel")
icon.name: "dialog-cancel"
onClicked: {
transaction.cancel()
sheet.acted = true
sheet.close()
}
Keys.onEscapePressed: clicked()
}
}
onSheetOpenChanged: if(!sheetOpen) {
sheet.destroy(1000)
if (!sheet.acted)
......
......@@ -214,7 +214,7 @@ void PackageKitUpdater::finished(PackageKit::Transaction::Exit exit, uint /*time
const auto toremove = m_packagesModified.value(PackageKit::Transaction::InfoRemoving);
if (!toremove.isEmpty()) {
const auto toinstall = QStringList() << m_packagesModified.value(PackageKit::Transaction::InfoInstalling) << m_packagesModified.value(PackageKit::Transaction::InfoUpdating);
Q_EMIT proceedRequest(i18n("Packages to remove"), i18n("The following packages will be removed by the update:\n<ul><li>%1</li></ul>\nin order to install:\n<ul><li>%2</li></ul>",
Q_EMIT proceedRequest(i18n("Packages to remove"), i18n("The following packages will be removed by the update:<ul><li>%1</li></ul><br/>in order to install:<ul><li>%2</li></ul>",
PackageKitResource::joinPackages(toremove, QStringLiteral("</li><li>"), {}),
PackageKitResource::joinPackages(toinstall, QStringLiteral("</li><li>"), {})
));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment