Commit graph

231 commits

Author SHA1 Message Date
Prajna Sariputra
f059491b95 [plugins/mousepad]: Add support for the persistence feature of the RemoteDesktop portal
This allows us to avoid asking the user for permission for remote control on Wayland every time kdeconnectd is restarted for whatever reason (for example logging out or rebooting), at least in theory. The idea is that the SelectDevices call now also accepts a restore token, and if the user grants permission to persist a restore token will be returned in the response of the Start call.

Currently https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/merge_requests/265 is required for this to work at all with Plasma 6, and even then persistence only works in the same session (for example if I restart kdeconnectd then I only get the notification instead of the permissions prompt), if I reboot the system then the token gets invalidated and the permissions dialog appears again, not sure if the issue is with what I'm doing here or if that's a bug in the portal.

Things that need to be checked:
- What happens if the portal implementation only has v1 of the protocol and not v2 (the one with persistence)?
  - In particular what happens for the SelectDevices call if a restore token is given despite the portal not supporting it
    - Seems fine with xdg-desktop-portal 1.14.4 at least
  - For the Start call we'll need to handle the case of the user denying the persistence request anyway
- Where and how should the restore token be stored?
  - ~~I used KConfig just so I have something to test, but the restore token isn't really a setting~~
    - Updated to use `KSharedConfig::openStateConfig`
  - Most of KDE Connect's settings and data appear to be for each connected device
  - The device name is a global setting, but it's implemented using QSettings rather than KConfig, and currently only setName and getName is exposed in `core/kdeconnectconfig.h`

BUG: 479013
(cherry picked from commit 383ad27b59)
2024-01-28 15:00:33 +01:00
Andreas Sturmlechner
79bc9a85e4 Cleanup all occurences of QT_MAJOR_VERSION in cmake
Follow-up to 7f03aa548c

Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
2023-12-28 17:49:07 +01:00
Alexander Lohnau
dc8f3e209e Reformat project with clang-format 2023-12-02 14:56:20 +01:00
Laurent Montel
b61f32262e GIT_SILENT: Adapt to KConfigGroup name officially being a QString type 2023-11-06 20:05:39 +01:00
Albert Vaca Cintora
cdcf44efa8 Remove photo plugin
As discussed in Matrix and BUG: 474121 this plugin is confusing (because
it doesn't actually take a photo, it just launches the camera on your
phone) and its use case can be covered by taking a photo and sharing it,
which only requires a couple extra clicks.
2023-09-15 23:04:17 +00:00
Alexander Lohnau
cfde9ced77 Also use QLatin1String::arg in remaining places
This is more readable, slightly faster at runtime and results in a slightly smaller binary size
2023-08-28 17:20:46 +00:00
Albert Vaca Cintora
5cc2043c35 Update old-style connect/disconnect where possible 2023-08-08 22:51:30 +02:00
Albert Vaca Cintora
a467247f08 Only use proxy signals for Q_PROPERTY NOTIFY
In other cases we can just connect to the signal from the parent class
2023-08-08 20:24:22 +02:00
Albert Vaca Cintora
2cfde60ab9 Fix clazy warning about re-defining signal 2023-08-08 20:24:22 +02:00
Alexander Lohnau
405f61bf85 Discard unused params more elegantly
By commenting out the parameter name, we get compile-time checks
Also, we can omit them for slots and Qt will not forward the parameters.

In case we had TODOs next to the code, I kept the Q_UNUSED statements
for now.
2023-08-05 20:22:18 +00:00
Alexander Lohnau
46feeda0cb Remove unused default destructors
Overriding and defaulting them in the header doesn't make sense

For the dbus interfaces, we don't have any reasources to clean up or memory to be released. Meaning we can drop those lines too
2023-08-05 20:22:18 +00:00
Alexander Lohnau
6fbecf28da Remove trailing / for KPluginMetaData::findPlugins
This is not needed and pretty much all usages of this method don't do it too
2023-07-31 06:39:08 +00:00
Alexander Lohnau
2e67f95017 Add explicit moc includes to cpp files
The rationale is explained in https://planet.kde.org/friedrich-kossebau-2023-06-28-include-also-moc-files-of-headers/

In case of KDEConnect, it impressively speeds up compilation. Before it
took 390 seconds on a clean build and with this change it took 330 seconds.
This is due to the mocs_compilation having to include the header files
and thus all their headers. Due to the lots of small plugins we have,
this means that the same headers must be compiled plenty of times.
When we include the moc files directly in the C++ file, they are already
available.
2023-07-30 07:27:45 +00:00
Alexander Lohnau
a1195a72a3 Use versionless Qt targets where possible
We depend on 5.15 which allows us to use those
2023-07-25 18:29:38 +02:00
Albert Vaca Cintora
59adbc2da4 Move all generated dbus interfaces to kdeconnectinterfaces exclude them from clazy
* Moves the XML definitions of DBus interfaces and code generation from the different plugins
  to kdeconnectinterfaces. Before each plugin had their own, some of them duplicated.
* Appends `// clazy:skip` to the generated interface files, so Clazy doesn't emit warnings
  about them because they are missing the NOTIFY/CONSTANT keywords on Q_PROPERTIES.
* Makes kdeconnectinterfaces static on Qt5 as well (removes a difference with Qt6).
* Moves the generated files to a `generated` directory and updates the includes so they are
  easily distinguished from other header files.
2023-07-24 12:18:47 +00:00
Albert Vaca Cintora
bd72602875 Move setWhenAvailable from dbusinterfaces to dbushelpers 2023-07-23 16:53:57 +02:00
Albert Astals Cid
7860280158 pretend autogenerated headers are system ones 2023-07-23 16:43:41 +02:00
Alexander Lohnau
e894f7c000 PluginModel: Do not call begin/end resetModel in constructor
This is only needed if we update the data afterward
2023-07-22 20:51:19 +00:00
Alexander Lohnau
9fdc2901b2 Use target-centric CMake approach rest of logging categories 2023-07-22 20:51:19 +00:00
Albert Vaca Cintora
dd4831f823 Add missing NOTIFY to properties 2023-07-22 20:09:46 +02:00
Albert Vaca Cintora
46cac0bf61 Fix qml runtime warning when accessing property without NOTIFIY 2023-07-22 19:58:56 +02:00
Alexander Lohnau
7d66b07ef7 Remove unused createId methods 2023-07-22 19:12:33 +02:00
Alexander Lohnau
ac3d439a2a Clean up unneeded version checks
With the min. version bumped, those can be safely removed
2023-07-22 16:17:24 +02:00
Nicolas Fella
d1d3e47eab Enable PIC for static lib
Otherwise it doesn't link
2023-07-20 16:17:56 +02:00
Alexander Lohnau
5456f726af Do not use empty QStringLiteral macro
QString is recommended instead
2023-07-20 13:32:16 +03:00
Alexander Lohnau
3effb006f3 interfaces: Build lib in Qt6 STATIC
Otherwise, the Q_OBJECT stuff is not properly exported and will result in linker errors
2023-07-20 11:16:04 +03:00
Alexander Lohnau
a9292f651f Port deprecated KPluginLoader usage 2023-07-20 11:15:46 +03:00
Alexander Lohnau
c5bfc4a5b0 Allow building against Qt6/KF6 2023-07-20 11:15:41 +03:00
Albert Vaca Cintora
22be63ae9e Remove compatibility with Qt < 5.15
In theory we support Qt 5.6 (because of SailfishOS) but in practice we are not checking that in the CI so probably we broke the compatibility long ago. Also, I don't think anyone is using this code in SailfishOS, so we can greatly simplify the code by requiring Qt 5.15 or later.
2023-07-18 20:13:27 +00:00
Albert Vaca Cintora
9c87393b28 clang-format pass 2023-07-16 16:20:34 +02:00
Albert Vaca Cintora
2e0550651e Remove mpris "nowPlaying" field
We've had separate title & artist for a while, and all clients should be
using those by now.

Also fixes the position change not being emitted when the song changes,
and fixes the values being written after emitting that they changed.
2023-06-08 21:58:58 +00:00
Albert Vaca Cintora
144a60b58a Allow disabling clipboard auto-share and add option to share manually
Continues the work started in !396 by rebasing it onto latest master and
making the "send clipboard" button from the plasmoid invisible when
automatic syncing is enabled.
    
I didn't find a way to do the same in kdeconnect-indicator and
kdeconnect-app (why do we have 3 UIs???), so in those we always show the
option for now.
2023-06-07 19:48:25 +00:00
Albert Vaca Cintora
064ddfa3fe Refactor PairingHandler
We now have a single PairingHandler for all types of links.

The implementation now is more aligned with the one for Android.
2023-06-02 16:38:52 +00:00
Volker Krause
002848efa8 Adapt build system to also support Qt 6
This is complicated by the Qt 5.6 requirement of SailfishOS, hopefully
that didn't get broken by this.
2022-10-29 16:51:41 +02:00
Simon Redman
8cfa308140 Fix some Qt and KF5 deprecation warnings
## Summary

Fixes a few warnings about deprecated fields and methods.

## Test Plan

Things still seem to be basically working 🤷
2022-10-17 21:17:49 +00:00
Kareem Abduljaleel
4ecf463cd1 [plasmoid] Add Photo to Plasmoid menu
Adds a menu entry to ask the remote device to take a photo to the Plasmoid menu
2022-09-28 13:03:48 +00:00
Nicolas Fella
a918ffc0cb Add and make use of ECM's clang-format integration 2022-09-11 23:21:58 +00:00
Laurent Montel
ba69e4a05a Remove extra ';' 2022-06-23 06:47:52 +02:00
Aleix Pol
084bfebcc8 Introduce the VirtualMonitor plugin
It allows to use other paired devices as external displays
transparently.
2022-05-25 00:04:47 +02:00
Nicolas Fella
8010739a8a [smsapp] Refactor and fix argument handling
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
2022-05-23 22:10:07 +00:00
Nicolas Fella
f7f3c01ec8 Use undeprecated install dirs
Using kde-dev-scripts/kf5/cmakelists_install_vars.pl
2022-04-21 00:50:14 +02:00
Weixuan Xiao
f1843cb492 Improve D-Bus implementation on macOS
Better patch to replace !218.

- Auto and quick detection of previous D-Bus instance;
- Remove private D-Bus compile definition, only use it on macOS without an existing D-Bus instance;
- Safe reboot after crashes because the indicator is not relating on the kdeconnectd to run a D-Bus session;
- Safe exit after clicking on `Quit` in the systray.


More details in commit logs:

Only enable private D-Bus on macOS because the other platforms do not
need them.
The app should be able to easily detect the session bus from the env
DBUS_LAUNCHD_SESSION_BUS_SOCKET from launchd through launchctl.
Because https://gitlab.freedesktop.org/dbus/dbus/-/blob/master/dbus/dbus-sysdeps-unix.c#L4392
shows that it is the only probing method on macOS with launchd.

The D-Bus session bus can be easily found from launchd/launchctl
with DBUS_LAUNCHD_SESSION_BUS_SOCKET env. It can be an external one
(installed from HomeBrew) or an internal one (launched by a previous
instance followed by a crash).

The indicator helper on macOS can now automatically detect whether we can use a potentially
(with launchd/launchctl env set, or KDE Connect macOS
private_bus_address set) existed and usable session bus.
If previous bus is usable, just try to launch the kdeconnectd with us.
Otherwise, launch a private D-Bus daemon, export the launchd/launchctl
env, and run a kdeconnectd instance.

Everything works better and quicker now :)
2022-04-12 05:40:03 +00:00
Laurent Montel
6957b6aa39 GIT_SILENT: add missing override 2021-10-27 06:53:06 +02:00
Nicolas Fella
eb5bd219f2 [interfaces] Make KConfig linkage public
It is used in a header so consumers need to link it too
2021-04-05 23:02:23 +02:00
David Shlemayev
a75da62f4d Add backend for ConnectivityReport plugin 2021-03-12 23:27:16 +00:00
Nicolas Fella
44a7fc226f Remove dead files 2021-02-27 20:06:10 +01:00
Bharadwaj Raju
ffdbd9aefe Fix notifications in the KDE Connect plasmoid
Corrects the DBus path to use for notifications, so now notifications
appear in the KDE Connect plasmoid as they should.

BUG: 432337
2021-01-31 18:57:12 +05:30
Jason Nader
b5ac96ce5b
plugins/battery: add battery charge info to the update signal 2020-12-13 21:28:23 +09:00
Nicolas Fella
473b1f07c3 [app] Improve plugin config delegates
Add description and make them more consistent with other list items in
KDE.
2020-11-16 12:21:47 +00:00
Nicolas Fella
753b1a2b0c Constify variable 2020-11-16 12:21:47 +00:00