<table><tr><td style="">dhaumann added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D7087" rel="noreferrer">View Revision</a></tr></table><br /><div><div><p>Thinking about it, what about this: The dialog already has all the QLabels. What you could do is something along the lines:</p>
<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">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);</pre></div>
<p>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.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R102 KInfoCenter</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D7087" rel="noreferrer">https://phabricator.kde.org/D7087</a></div></div><br /><div><strong>To: </strong>gregormi, ngraham, dhaumann<br /><strong>Cc: </strong>rkflx, dhaumann, ltoscano, sebas, elvisangelaccio, cfeck, plasma-devel, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, apol, mart<br /></div>