Commit graph

15 commits

Author SHA1 Message Date
Alexander Lohnau
83888412a9 Simplify and optimize some string usages
- Using QLatin1String when concatinating strings is faster, because they
  are more lightweight. For the resulting string, we need to allocate
  new memory anyway
- Use QLatin1String overloads where they are provided by Qt APIs
- Just use const char* for log messages, the quoting of QStrings is not
  needed
- Make sure to reuse string results when possible
2023-08-05 20:22:18 +00:00
Alexander Lohnau
1631ada5b3 Simplify KDEConnectPlugin::recievePacket
- We do not need the return type. If a plugin declares it can handle the
  packet it should do so. We don't have any fallback logic in place and
  the packet types are namespaced with the plugin IDs anyway.

- Provide a default implementation with a warning, not all plugins need
  to overwrite this
2023-08-03 20:49:44 +02:00
Alexander Lohnau
7091f333f9 Do not mark plugin classes as exported
This is not needed, because only a symbol to create the KPluginFactory
instance must be exported. The KPluginFactory macros or rather the underlying
Q_PLUGIN_METADATA macro already take care of that.

In other plugin code of KDE, we also do not export classes.
The size of the generated plugin files is nearly identical, but removing
the macros avoids confusion for developers.
2023-07-22 20:51:19 +00:00
Alexander Lohnau
75a8db1ec5 Use pragma once in plugins
For non-library code, this is simpler and more concise
2023-07-22 20:51:19 +00:00
Nicolas Fella
a918ffc0cb Add and make use of ECM's clang-format integration 2022-09-11 23:21:58 +00:00
Piyush Aggarwal
d22c6641b4 contactsplugin: save vcards in Contacts folder provided by Windows 2021-06-13 06:58:12 +05:30
Nicolas Fella
87db95b22f Convert license headers to SPDX expressions 2020-08-17 09:48:10 +00:00
Nicolas Fella
e601755644 Force usage of QStringLiteral and port remaining offenders 2019-06-10 14:40:28 +00:00
Simon Redman
eb0e3fce03 [Contacts Plugin] Fix brace placement and mild cleanup 2019-05-08 18:10:02 -06:00
Simon Redman
320c070c99 Move contacts synchronization to connected method 2019-05-08 18:02:32 -06:00
Nicolas Fella
92a2da05e6 Don't unregister plugins from DBus in contructor 2019-05-05 12:57:28 +00:00
Nicolas Fella
137d504b58 [plugins/contacts] Unify coding style 2019-05-04 16:15:49 +02:00
Nicolas Fella
3b8fedea1a Replace http GNU urls with https 2019-03-23 17:29:26 +01:00
Nicolas Fella
f2db6351cc [plugins/contacts] Don't link against KI18n 2019-03-11 19:03:10 +01:00
Simon Redman
9c1d6e43ad Add contacts-reading plugin (KDE side)
Summary:
Add a plugin to KDE Connect which supports exporting the Android contacts databases to vcards on the desktop

When the devices are connected, the plugin sends a request for all timestamps and IDs

When a packet with timestamps and IDs is received, it verifies it has vcards for each ID and that the timestamps match and deletes any vcards for IDs which were not reported. It then sends a request for all vcards which were missing or need updating

When a packet with vcards is received they are unconditionally written to disk, possibly overwriting existing vcards

Provides one dbus method: contacts/synchronizeRemoteWithLocal which triggers the request for all timestamps and IDs

BUG: 367999

Test Plan:
Connect the device to the desktop and verify that vcards are created in QStandardPaths::GenericDataLocation / kpeoplevcard". On my system this is ~/.local/share/kpeoplevcard

Create a dummy contact on the device and verify it is synchronized (Currently not automatic, have to disconnect and reconnect or use dbus)

Modify the dummy contact and verify the modifications are synchronized (Currently not automatic, have to disconnect and reconnect or use dbus)

Delete the dummy contact and verify the deletion is synchronized (Currently not automatic, have to disconnect and reconnect or use dbus)

Reviewers: #kde_connect, apol

Reviewed By: #kde_connect, apol

Subscribers: mtijink, #kde_connect, apol

Tags: #kde_connect

Maniphest Tasks: T8283

Differential Revision: https://phabricator.kde.org/D9691
2018-04-23 22:30:27 +02:00