D7087: Add "Copy Info" button to the About System KCM

Dominik Haumann noreply at phabricator.kde.org
Thu Feb 15 21:20:08 UTC 2018


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20180215/4721281a/attachment.html>


More information about the Plasma-devel mailing list