Shift+return was always inserting newline at the end of the current line of text, ignoring where the cursor was, and not overriding currently selected text
BUG: 488585
## Summary
Due to the difficult-to-test Qt5 -> Qt6 transition, there were some GUI errors with the SMS app:
- Contact photos were missing
- Attachment previews, if present, were in the place where the contact photo should be
This also takes a shot at fixing the long-standing issue that attachment previews were shown much taller than the row item, drawing over the items above and below.
## Test Plan
### Before:
As in description, the conversations list items were not correct.
![image](/uploads/f68b662fecd6a4826986ede6e8191470/image.png)
### After:
Contact photos are shown to the left of the text preview, attachment preview, if present, is shown to the far right.
![image](/uploads/95f2b4d6e6ff26371a2f36d97fc3f52b/image.png)
Preview icon and subtitle formatting were not optimal (shifted and
not eliding properly). Refactor the delegate into a ItemDelegate
with a proper content item.
In addition, clean up some redundancy and generally refactor the
qml properties/items.
Unfortunately, most issues are in Kirigami and we can't fix them from our side. Namely, these things remain unfixed:
- `Kirigami.PlaceholderMessage` are not read by screen readers
- When navigating with the keyboard, pressing tab selects elements from right to left, which is weird
- When navigating with the keyboard, the selected element is not highlighted
- `Kirigami.Action` that don't have a `text` property don't use the `Accessible.name` property when using a screen reader.
Directly calling signals is the supported way to send signals.
Calling signal handlers worked in the past, but will be phased out in
the future (https://bugreports.qt.io/browse/QTBUG-120573).
The "enabled" property of the button was set to false and has overwritten the default value based on the message length.
The message field had "anchors.fill" positioning and raised "Binding loop detected for property "implicitHeight"" error.
attachmentList property of ChatMessage didn't have the default value and was undefined.
BUG: 455149
## Summary
For awhile (since at least early last year), it has not been possible to scroll past the first screen of message history. I believe this was due to a version bump in some library, but I was not able to biset it at the time.
This changes how messages are loaded to work again. I like this solution better anyway, because it means one can smoothly scroll back in time without needing to stop every time you reach the top of the history.
BUG: 452946
## Test Plan
### Before:
Scrolling to the top of the kdeconnect-sms history would do nothing. You could only view the first handful of messages in the conversation (whichever messages the app decided to load for you when you first open the conversation).
### After:
Scrolling to the top of the list of messages will cause the app to load more, allowing you to view more history of messages.
Use a singleton instead of context properties for data handling
Fix passing initial message
Make device menu creation more declarative
Fix initial device handling
Update current device when new instance with initial device is requested
- Move the device combobox to the global drawer
- Move search field and new button to header
- Use Kirigami SearchField instead
- Don't switch focus away from search field when typing
- Give the New button an icon
- Clarify the search field text
- Center messages view loading indicator
- Make send and attach buttons stick to bottom of text area
- Make cursor an I-beam when hovering over text area
- Move send button to the right
- Give proper padding to messages view top
- Move refresh action to global drawer
- Show refresh button directly in loading message where it is most useful
| Before | After |
| ------ | ------ |
| ![kdeconnectsms-old1](/uploads/469fa5f198ce81f1f53e8aa73694a824/kdeconnectsms-old1.png) | ![kdeconnectsms-new1](/uploads/c3b2b552d5d1bb73c566c6879c5b2a3c/kdeconnectsms-new1.png) |
| ![kdeconnectsms-old2](/uploads/eed795529946ed9ff856d8599bc66fb2/kdeconnectsms-old2.png) | ![kdeconnectsms-new2](/uploads/7abff93670aaea36052f3e3bfe01da62/kdeconnectsms-new2.png) |
| ![kdeconnectsms-old3](/uploads/f24dc7a902e33a1317cc8d9b90c39482/kdeconnectsms-old3.png) | ![kdeconnectsms-new3](/uploads/ea7d07f64d1904757dce56e86f1876ba/kdeconnectsms-new3.png) |
cc @teams/usability @teams/vdg
This commit makes use of the Kirigami.PlaceholderMessage component
instead of a QML Label, also moves the placeholder message to be
inside the ListView.
## Summary
Replace the (deprecated and removed) reference to `Kirigami.Theme.viewBackgroundColor` with `Kirigami.Theme.backgroundColor`
This element is necessary in order to have theme hot-switching work correctly
BUG 434791
## Test Plan
### Before:
When using the KDE Connect SMS app in an un-modified dark theme, the message entry text box would be rendered as all white and text would correctly be rendered in white (making it un-readable).
This seems to be somehow related to a recent Kirigami version (it only happened to me after doing a distro upgrade and my ancient Kirigami installed to ~/.prefix does not reproduce the issue).
viewBackgroundColor was deprecated and apparently removed from Kirigami a version or two ago. Thus the coloring was no longer correct.
For screenshots and discussion, see [bug 434791](https://bugs.kde.org/show_bug.cgi?id=434791)
### After:
Text and background are rendered in the expected colours for the theme.
The current implementation seems to have an issue with an undetected binding loop that causes lockup. During investigation I figured that the code was way to complex and brittle for what we need.
This is a cleaner reimplementation. It also replaces the custom Avatar component with the one from Kirigami.
The looks are subject to tweaking of course
Launching smsapp prints:
qrc:/qml/main.qml:36: ReferenceError: _initialMessage is not defined
This patch applies the changes made to the property from C++ in
c17972881b to QML.