dhaumann added a comment.
Thinking about it, what about this: The dialog already has all the QLabels.
What you could do is something along the lines:
QString text;
if (!ui->plasma.text().isEmpty()) {
text += i18n("%1: %2", ui->plasmaLabel, ui->plasma.text());
}
if (!ui->bla.text.isEmpty()) {
text += i18n("%1: %2", ui->blaLabel, ui->bla.text());
}
QGuiApplication::clipboard()->setText(text);
What you would gain is that the code - albeit maybe a bit verbose - is
simple, easy to understand and extend, and all the copy-to-clipboard code is in
one place. And it reuses what's already in the labels. The i18n() thing may
still be problematic, but given the dialog itself already uses two different
labels for the text, this mostly should be fine.
REPOSITORY
R102 KInfoCenter
REVISION DETAIL
https://phabricator.kde.org/D7087
To: gregormi, ngraham, dhaumann
Cc: rkflx, dhaumann, ltoscano, sebas, elvisangelaccio, cfeck, plasma-devel,
ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, apol, mart