Commit graph

164 commits

Author SHA1 Message Date
Nicolas Fella
1bebc3bc5d Fix build with MDNS disabled 2023-09-11 03:15:27 +00:00
Albert Vaca Cintora
5e225a23cb Add MDNS e2e test 2023-08-28 17:08:18 +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
c5bfc4a5b0 Allow building against Qt6/KF6 2023-07-20 11:15:41 +03:00
Albert Vaca Cintora
495e3019e4 Reduce number of optional dependencies
Change some optional dependencies from being optional to being mandatory
or being mandatory but behind on-by-default cmake flags. Eg: instead of
only compiling Wayland support if we find the appropriate libraries, we
always require the libraries unless the user specifies WITH_WAYLAND=OFF.

Optional libraries are hard to discover by packagers (since they don't
see an error once we add them) and create lots of possible build flavors
with a different features that can confuse users.
2023-07-19 17:08:03 +00:00
Albert Vaca Cintora
5796b561bf Simplify the code that reads from the socket line by line
Since sockets are buffered `QIODevices` we can use `canReadLine()` to check
if we have a full line, instead of using a custom `SocketLineReader` class
(and the copy-pasted `DeviceLineReader` in the Bluetooth backend). 

We can also loop through all the lines instead of queuing calls to `dataReceived`.

And we don't need transactions.
2023-07-10 15:58:56 +00:00
Albert Vaca Cintora
db546e7608 Add DeviceInfo class
Equivalent to this Android MR (see description there): https://invent.kde.org/network/kdeconnect-android/-/merge_requests/374
2023-06-27 11:10:59 +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
Albert Vaca Cintora
74caaface0 Further KIO::AccessManager cleanup 2023-04-10 08:29:48 +00:00
Nicolas Fella
2c2e883288 Don't use KIO::AccessManager
The main thing it provides over QNetworkAccessManager is integration
with the CookieJar and using kio-http, but since we jsut exchange bytes
from another local device that's not interesting for us
2023-04-10 08:29:48 +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
Nicolas Fella
a918ffc0cb Add and make use of ECM's clang-format integration 2022-09-11 23:21:58 +00: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
Ahmad Samir
ad7b5b42b2 Use AccessManager from KIO::Integration
The same functionality, but a different namespace.

GIT_SILENT
2021-12-25 18:26:01 +02:00
Nicolas Fella
8b82a30d40 CMake cleanup
Remove all include_directory calls

They are either unnecessary or can be done better
2020-11-16 12:21:07 +00:00
Aleix Pol
8112729eb0 Don't brute-force reading the socket
The package will arrive eventually, and dataReceived will be emitted.
Otherwise we just end up calling dataReceived to no end.

Thanks Matthias Gerstner <mgerstner@suse.de> for reporting this.
2020-10-02 12:52:08 +02:00
Aleix Pol
d4cf48901c SocketLineReader: don't call packets bytes 2020-09-16 02:16:06 +02:00
Nicolas Fella
87db95b22f Convert license headers to SPDX expressions 2020-08-17 09:48:10 +00:00
Simon Redman
2a2481fb6a Fix build 2020-03-21 15:44:13 -07:00
Simon Redman
b7643ecbad Delete flakey tests 2020-03-21 22:25:01 +00:00
Nicolas Fella
eac1e07e29 Revert "Make default name and device type customizable"
This causes a crash described in https://invent.kde.org/kde/kdeconnect-kde/-/merge_requests/206#note_37534

This reverts commit a39a2d562d.
2020-03-21 21:13:41 +01:00
Richard Liebscher
a39a2d562d Make default name and device type customizable 2020-03-01 20:55:40 +00:00
Richard Liebscher
456d4830fe Made code more explicit and additional tests. 2020-01-04 14:13:36 +01:00
Richard Liebscher
f9f1eb6ed0 Added test 2020-01-03 17:15:51 +01:00
Yuri Chornoivan
01c4d0411b Fix minor EBN issues 2019-12-22 09:49:55 +02:00
Richard Liebscher
ba34672cbd Make build for SailfishConnect possible 2019-12-09 22:14:19 +00:00
Nicolas Fella
724a5a14a8 Don't use KIO in core when building for Sailfish 2019-10-27 19:35:18 +00:00
Nicolas Fella
39fe270cd1 Port Kdeconnectconfig to reference based singleton
It's more expressive in the sense that it makes clear that the user should not delete the object
2019-09-08 17:09:52 +02:00
Nicolas Fella
0d7c504cf0 Rename DbusHelper => DBusHelper 2019-08-14 17:36:19 +02:00
Heiko Becker
5d7983f52d testsmshelper: Use QTEST_GUILESS_MAIN
The test still works fine with it, allowing it to run without a display
server.
2019-08-01 22:41:10 +02:00
Simon Redman
3c783c4505 Remove reference to non-existant cmake variable
SMSAPP_ENABLED no longer exists
2019-07-29 22:43:38 +02:00
Nicolas Fella
3394c6da5d Use QImage::sizeInBytes() 2019-07-20 13:09:35 +02:00
Sandro Knauß
f044384c15 fix race condition on tests.
The test expects the SSL server socket to be encrypted, but was
not waiting for it to happen.

Use a QSignalSpy to wait for the signal that ensures us we can go ahead.
2019-07-05 12:53:06 +00:00
Weixuan Xiao
4f4b6c309f Allow to use private DBus 2019-06-18 01:21:31 +00:00
Nicolas Fella
e601755644 Force usage of QStringLiteral and port remaining offenders 2019-06-10 14:40:28 +00:00
Simon Redman
3c346b9409 Block matching empty phone numbers 2019-06-07 16:39:18 -06:00
Simon Redman
c7579eb170 Fix LanLinkProviderTest on Windows
## Summary
LanLinkProviderTest fails on Windows. This patch fixes that.

I believe the root cause is that we are using a shared UDP socket to listen for identity broadcasts both in the LanLinkProvider and in the test. Apparently this works on Linux, but on Windows the LanLinkProvider picks up its own identity packet and pairs with itself.

This patch gives a parameter to LanLinkProvider to allow it to listen and broadcast on different ports, then uses that ability in the test to make the test pass on Windows.

## Test Plan

### Before:
lanlinkprovider test fails, first because it can't bind its UDP listener socket, and then because Windows seems to handle shared sockets differently than Linux, so the UDP broadcasts were not reaching the test's listener.

### After:
lanlinkprovider test seems to pass reliably both in my Windows VM and in the CI
2019-06-05 15:14:50 +00:00
Simon Redman
9453e640b3 Refactor testdevice 2019-06-05 02:42:06 +00:00
Simon Redman
673c3ced69 Make testsslsocketlistener properly timeout 2019-06-05 02:40:26 +00:00
Simon Redman
24ab6d15cf ## Summary
pluginloadtest and sendfiletest are crashing. This patch fixes that by allowing Daemon::init() to be called from TestDaemon

## Test Plan

### Before:
Both tests are crashing because it is not able to find any devices. It is not able to find any devices because the LanLinkProvider is not being added because Daemon::init() is not being called.

### After:
pluginloadtest and sendfiletest pass
2019-06-02 21:26:47 +00:00
Simon Redman
e8a2e81421 Move SMS App helper functions to their own file 2019-06-02 14:52:54 +00:00
Weixuan Xiao
17e4360c53 Enable sms test only when SMSAPP_ENABLED set to ON 2019-05-31 20:17:38 +00:00
Simon Redman
05826cc650 Allow all-zero phone number 2019-05-30 18:48:14 -06:00
Simon Redman
a5a0c16b61 Match contacts with many phone numbers
Also adds testing for some back-end of the SMS app
2019-05-30 19:18:32 +00:00
Albert Vaca
3fc7df550b Better error handling when loading cert and key
BUG: 405207
2019-05-09 00:03:59 +02:00
Nicolas Fella
0692295ae7 s/Q_NULLPTR/nullptr/ 2019-05-05 15:45:50 +02:00
Nicolas Fella
d4026861ab Clean up includes 2019-04-30 19:03:24 +02:00
Nicolas Fella
3b8fedea1a Replace http GNU urls with https 2019-03-23 17:29:26 +01:00
Albert Vaca Cintora
ad21af639f Assert after waiting and not before 2019-03-14 14:27:34 +01:00
Albert Vaca Cintora
9d7fe401f8 This should do 2019-02-13 00:29:05 +01:00