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.
## Summary
This patch makes SMS message field scrollable and limits its height to ⅓
of window height (or ⅔ for smaller windows) so messages in conversation
are shown even when writing very long messages.
## Test Plan (and screenshots)
<small>These screenshots are in APNG and WEBP formats. Download them if
your browser does not support this format.</small>
### Before:
Message field height was not limited. Message field could be even higher
than window. That makes first lines of this field and messages in
conversation inaccessible.
![grab-noscroll.apng](/uploads/70a44ec3abd0e0707cf69f53ee832542/grab-noscroll.apng)
### After:
Message field height is limited to ⅓ or ⅔ of window height. When text
content reaches this threshold, scroll bars will show up.
![grab-scroll.webp](/uploads/489b9bb197a092f715bc2160acc7fd42/grab-scroll.webp)
SMS character counter was changing its width (both growing and
shrinking) so it also resized message field (and that caused text
reflow). This patch makes counter width only grow.
Type SMS that is long enough to make SMS character counter wider than
“Send” button. Remove the text (leave there 150 or 60 chars to keep it
visible). Character counter should keep its width.
## Summary
This adds character counter below the “Send” button in SMS conversation. It
uses format XXX/Y where XXX is number of characters that can be added
without splitting the SMS into multiple messages (see article
Concatenated SMS on Wikipedia). Y is number of messages in in current
concatenated SMS. The counter is not visible when insertion of 10 7-bit
or 16-bit (depends on SMS encoding) does not create concatenated SMS.
SMS encoding is automatically guessed. 8-bit encodings are not
supported. If the message contains characters that are not supported by GSM 7-bit
encoding, counter automatically switches to UCS-2.
## Test Plan
Try entering some text that is longer than 150 characters in [GSM 03.38 encoding][1] or 60 characters in UCS-2. Number of remaining characters should be visible below the “Send” button. The character counter should show `0` at exactly 160 or 70 characters. Inserting one character should switch the counter to [Concatenated SMS][2] mode when number of messages is shown.
It should show exactly same number as SMS app in Android.
## Screenshots
These images are in APNG.
![grab.apng](/uploads/21ae23f2fa75c7aca487e61ddce94644/grab.apng)
![grab-cz.apng](/uploads/785e670a8598c5a65a4209f17e75f578/grab-cz.apng)
[1]: https://en.wikipedia.org/w/index.php?oldid=932080074#GSM_7-bit_default_alphabet_and_extension_table_of_3GPP_TS_23.038_/_GSM_03.38
[2]: https://en.wikipedia.org/w/index.php?oldid=943185255#Message_size
## Summary
Start a conversation with contacts having no previous conversation with.
It is currently only possible to use the messaging app to send a message to a conversation which already exists.
This patch implements this feature by integrating all contacts having no prior conversation with the recent conversations in the recent conversation list and at the bottom in a sorted manner, something like this,
The contacts are stored in the recent conversation list model as a conversation but with INVALID conversation ID and INVALID conversation DATE.
## Testing
Testing just needs kdeconnect daemon to be recompiled and executed.
This may need to be reworked at some point for more advanced usecases (multiple apps listening to SMS, variable-length message requests, etc.) but it's fine for now
BUG 410095