Use plasma TextArea for sharing text in plasmoid
ClosedPublic

Authored by blaws on Nov 9 2018, 6:07 PM.

Details

Summary

This also fixes a bug where the box could be too small.
BUG: 400862

Diff Detail

Repository
R224 KDE Connect
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
blaws created this revision.Nov 9 2018, 6:07 PM
Restricted Application added a project: KDE Connect. · View Herald TranscriptNov 9 2018, 6:07 PM
Restricted Application added a subscriber: kdeconnect. · View Herald Transcript
blaws requested review of this revision.Nov 9 2018, 6:07 PM

This works on my computer. I have attached a screenshot. The borders, etc. look good with one line as well as many lines

@apol Is the best for giving feedback on this. My concerns would be:

  • Does using the Plasma TextArea make us dependent on Plasma, or was that already implied by being a plasmoid?
  • What does the Plasma TextArea offer vs. the QtQuickControls 2 TextArea?
plasmoid/package/contents/ui/DeviceDelegate.qml
254

Magic numbers are to be avoided. If the constant offset is necessary, it would be best to give it a name by adding a readonly property <type> <name>: <value> then use the name. That way, at least it is clear what the thing being added is. Bonus points for a comment on the line declaring the property to say how it was calculated or its purpose :)

I would like to see a comment explaining what Math.max is calculating. In case of an unbounded height, it seems quite strange.

nicolasfella added a subscriber: nicolasfella.EditedNov 9 2018, 6:30 PM

Does using the Plasma TextArea make us dependent on Plasma, or was that already implied by being a plasmoid?

We're using Plasmacomponents elsewhere in the plasmoid already. It creates a runtime dep on plasma-framework, but that doesn't harm using KDE Connect outside of Plasma

blaws updated this revision to Diff 45191.Nov 9 2018, 6:49 PM

Use correct padding value instead of multiplying font (wrong)

nicolasfella requested changes to this revision.Nov 9 2018, 6:55 PM

I found a more elegant solution: Use the Textfield from Plasmacomponents 3. Include it via

import org.kde.plasma.components 3.0 as PC3

And then use

PC3.TextField {
...
}

without setting any height

This revision now requires changes to proceed.Nov 9 2018, 6:55 PM
blaws updated this revision to Diff 45192.Nov 9 2018, 6:58 PM

Use plasmacomponents3 TextArea which auto extends

blaws marked an inline comment as done.Nov 9 2018, 7:00 PM
nicolasfella accepted this revision.Nov 9 2018, 7:00 PM
This revision is now accepted and ready to land.Nov 9 2018, 7:00 PM

Do we need both PlasmaComponents 2 and PlasmaComponents 3? (Does it make a difference?)

blaws updated this revision to Diff 45194.Nov 9 2018, 7:04 PM

Clear text area when sent

Do we need both PlasmaComponents 2 and PlasmaComponents 3? (Does it make a difference?)

There is D11653 which ports everything to PC3

This revision was automatically updated to reflect the committed changes.