Commit 149212e7 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

[Notifications] Hide job info label for successive jobs

When multiple jobs of the same kind are listed, visually group them.
While this doesn't actively group them (i.e. having a copy, a move, and a copy again
won't move the second copy job to the first - there's no real model underneath, so we
cannot just drop a sort proxy model ontop),
it still improves the most likely situation of copying multiple different things at once.

Differential Revision: https://phabricator.kde.org/D6109
parent 83ed4da7
......@@ -41,6 +41,8 @@ Column {
readonly property string label1: getData(jobsSource.data, "label1", '')
readonly property bool isSuspended: getData(jobsSource.data, "state", '') === "suspended"
property alias infoMessageVisible: infoLabel.visible
function getData(data, name, defaultValue) {
var source = model.name
return data[source] ? (data[source][name] ? data[source][name] : defaultValue) : defaultValue;
......
......@@ -144,7 +144,24 @@ Column {
}
Repeater {
id: jobsRepeater
model: jobs
delegate: JobDelegate {}
delegate: JobDelegate {
infoMessageVisible: {
if (!infoMessage) {
return false;
}
// hide info message if it's the same as the previous job, while we don't
// actively group those jobs, it still improves the situation where you
// started copying a couple of different things simultaneously
var previousItem = jobsRepeater.itemAt(index - 1);
if (!previousItem) {
return true;
}
return previousItem.infoMessage !== infoMessage;
}
}
}
}
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