Commit graph

258 commits

Author SHA1 Message Date
Àlex Fiestas
11a01d2f4e
Set unique include guard
Otherwise the code will not compile if both, lan and bluetooth are
enabled.
2017-05-24 23:54:59 +02:00
Albert Vaca
6792b45fae
Adapt to new API in master 2017-05-24 23:54:58 +02:00
Saikrishna Arcot
d711547ab5
Add initial Bluetooth backend implementation.
KDE Connect runs, and the bluetooth service gets published in the SDP
(service discovery protocol), which other devices use to determine what
services are available.

The getPairedDevices() method in the link provider class uses D-Bus to get
the list of paired devices, since Qt doesn't have a method giving that
information. As a result, that part of the code only works on Linux.

REVIEW: 122174
2017-05-24 23:54:58 +02:00
Albert Vaca
34d419756b Merge branch '1.x' 2017-04-13 21:23:29 +02:00
Albert Vaca
a4f2a60d47 Do not use the default proxy.
Qt uses the system proxy if set up, explicitly disable it.

BUG: 376187
2017-03-06 22:02:08 +01:00
Albert Vaca
1b308a547d Fix warning because of missing enum value in switch 2017-02-18 15:32:55 +01:00
Albert Vaca
2c1c8525e5 Now a 100% more compiling 2017-02-14 23:03:59 +01:00
Albert Vaca
25e0cea373 Make error message reflect the actual ports we use 2017-02-14 22:52:37 +01:00
Albert Vaca
f0a96a3ab9 Do not error if we try to request pair again 2017-02-10 00:54:03 +01:00
Albert Vaca
7e63a90da6 Merge branch '1.x'
# Conflicts:
#	app/org.kde.kdeconnect.app.desktop
#	plugins/kdeconnect.notifyrc
#	plugins/remotecommands/kdeconnect_remotecommands.json
#	plugins/sendnotifications/kdeconnect_sendnotifications_config.desktop
2017-02-05 16:12:25 +01:00
Albert Vaca
12a3027be6 Wrong order, condition was always false. 2017-02-05 16:08:20 +01:00
Aleix Pol
5d088041c0 Don't leak pairing handlers 2017-01-25 01:16:07 +01:00
Aleix Pol
ea41d3786e Expose pairing state for devices
Will allow to have information about whether we're pairing, mostly for
better GUI.

Pair-programmed with Albert Vaca
2017-01-25 00:22:22 +01:00
Holger Kaelberer
a75e0ba031 Make pairing notifications more persistent
Notifications are not persistent, and once gone there is no
way to accept the request. Clicking the notification in the
notification history does nothing in plasma and gnome.

There make them persistent and close them after the pairing timeout,
after which they are no longer useful.

BUG: https://phabricator.kde.org/T5002
2017-01-05 19:11:55 +01:00
Albert Vaca
beeae63086 Missing Q_OBJECT macro 2016-11-26 16:36:34 +01:00
Albert Vaca
60331ccbf1 Clazy says all this QStringLiteral and QLatin1String were missing/wrong 2016-11-26 16:21:29 +01:00
Albert Vaca
a1340c8042 Fixed old style connects with clazy 2016-11-26 15:14:19 +01:00
Albert Vaca
f845b33392 Fixed bug on Windows 2016-11-20 04:25:11 +01:00
Albert Vaca
c9cfac7253 Remove debug logs 2016-08-29 11:00:35 +02:00
Aleix Pol
0774020899 Merge branch '1.0' into 1.x 2016-08-14 21:15:13 +02:00
Aleix Pol
91f952f5f1 Fix test
Use the right port
Store the port in a public variable, so it can be used from the test.
2016-08-08 19:38:58 +02:00
Albert Vaca
50496a3442 Reverted change that introduced a crash.
If there are ssl erros with unpaired devices, link was null.

This reverts commit 7da30ddbb1.
2016-08-03 22:01:04 +02:00
Albert Vaca
2cdf7d5499 Reduced logging 2016-07-12 12:49:21 +02:00
Albert Vaca
f41877fbec Disabled removing links when exiting discovery mode because it was broken.
If both devices are in "discovery mode" (ie: both want to keep links
established) and the last one to create the link goes out of discovery
mode, it will close the link when it shouldn't (because the other end still
was "using" it to display it to the user).
2016-07-12 12:38:40 +02:00
Albert Vaca
7da30ddbb1 Use the pairing handler instead of accessing the device directly on error 2016-07-12 12:34:56 +02:00
Albert Vaca
4e8a325479 Do not specify type for struct 2016-07-12 12:32:58 +02:00
Albert Vaca
47c78427cb Removed outdated comment 2016-07-07 01:07:51 +02:00
Albert Vaca
5933c6810c More unused includes cleanup 2016-07-05 14:27:53 +02:00
Albert Vaca
7c0fbbc034 Unused include cleanup 2016-07-05 14:13:48 +02:00
Albert Vaca
9c736583e2 Use the actual connection origin, so we don't keep all connections open. 2016-07-05 12:42:39 +02:00
Aleix Pol
2b451097eb Make sure errors get reported 2016-07-05 01:00:02 +02:00
Albert Vaca
385bf77480 Fixed bug which didn't allow to pair a new device 2016-07-04 19:52:37 +02:00
Aleix Pol
359194c2ed Use initializers to construct it 2016-07-04 19:18:13 +02:00
Albert Vaca
04713de718 Remove qdebugs 2016-06-26 15:48:37 +02:00
Aleix Pol
ef98fb4587 Fix file transfer under SSL
Introduces a big fat buffer :(
Actually test the trasfers :)
Takes QSslSocket causistic into account, for some reason QNAM refuses to
mark as finished when the QSslSocket (through QIODevice) closes.
It would be good to look into dropping the QBuffer, doing so with the test
in place will help.
2016-06-22 17:49:45 +02:00
Albert Vaca
01139d31d1 De-duplicated socket SSL configuration code 2016-06-22 14:27:09 +02:00
Aleix Pol
4cb50d69d8 Fix some issues in the downloadjob and its test
Test on KJob abstraction, this way we can check if it has an error when it
breaks.
Handle errors in a different branch of the code.
2016-06-22 12:40:14 +02:00
Aleix Pol
f9406e8afc Introduce QVariantMap as an argument of NetworkPackage
Makes it possible to specify the different properties sent at once,
rather than one by one as we used to do.

Also port whenever possible to the initializer-list syntax.

REVIEW: 128269
2016-06-21 20:07:12 +02:00
Albert Vaca
e880e14ed5 Preffer Q_FOREACH to foreach 2016-06-21 14:50:17 +02:00
Albert Vaca
5abd081b85 Changed port so we don't conflict with Houdini 2016-06-21 14:42:32 +02:00
Aleix Pol
596e4484f4 Clean up use of virtual and override keywords
Only use virtual when actually virtual, to override just use override.
2016-06-20 19:22:29 +02:00
Albert Vaca
c4d7c2f39b Improved comments 2016-06-17 02:00:23 +02:00
Albert Vaca
e379fcd69d Destroying a socket should not destroy the link.
Also, sockets can be destroyed as soon as the socketreader is deleted.
2016-06-17 02:00:23 +02:00
Albert Vaca
91c23dfdea Do not compare against the current version of the protocol 2016-06-16 19:48:23 +02:00
Albert Vaca
cb0fd1fe20 Removed a case where we would still add a link on old protocol versions 2016-06-15 20:38:57 +02:00
Aleix Pol
5715926c5c Export the symbols needed by the tests 2016-06-10 15:07:33 +02:00
Albert Vaca
3177143439 Fixed build on windows 2016-06-09 02:36:02 +02:00
Albert Vaca
1c315af108 Revert "Fix file transfers"
This reverts commit 252ea4ba20.
2016-06-07 00:28:52 +02:00
Aleix Pol
751bd5849b small style changes 2016-06-06 01:21:37 +02:00
Frederik Schwarzer
a594324d4f Fix message wording. 2016-06-03 21:33:25 +02:00
Aleix Pol
252ea4ba20 Fix file transfers 2016-06-03 16:38:04 +02:00
Albert Vaca
7a0bb09353 Make sure we don't broadcast more than once at the same time.
Race conditions might happen because two links will be created.
2016-06-02 12:18:51 +02:00
Albert Vaca
7a67274a18 Fixed memory leak. 2016-06-02 12:17:07 +02:00
Albert Vaca
5654300249 Removed logs 2016-05-31 20:09:52 +02:00
Vineet Garg
b96227ae75 Changed protocol version to TLS 1.0, as TLS 1.2 not supported on many Android device
Choosing cipher suites manually, same as of Android
2016-04-30 20:39:34 +05:30
David Kahles
abc5fa3c56 Remove second UDP socket in LanLinkProvider
We don't need two sockets for reading and writing.

REVIEW: 127769
2016-04-28 00:19:20 +02:00
Albert Vaca
78d4ba2106 Cleanup 2016-03-08 07:29:34 -08:00
Albert Vaca
ff9775e1c9 Better logging of what's going on 2016-03-07 16:01:44 -08:00
Albert Vaca
8f9fde8f40 Fixed crash when pairing old Android apps. 2016-03-02 16:38:03 -08:00
Albert Vaca
ebd429629a Fixed unpairs never being sent 2016-03-02 16:17:38 -08:00
Albert Vaca
ea812f1101 Attribute not needed 2016-03-02 15:50:06 -08:00
Albert Vaca
90d2b0ad69 Changing TLS version to what is used in LanLinkProvider.
Android<16 doesn't support TLS>1.0
2016-02-12 09:02:56 -08:00
Albert Vaca
6cde0271fb Removed loopbackpairinghandler 2016-02-12 07:59:12 -08:00
Albert Vaca
aa4150f0c9 Moved ConnectionStarted from DeviceLink to LanDeviceLink 2016-01-10 07:12:13 -08:00
Albert Vaca
2aca5ca11e Added error message when trying to pair older devices 2015-12-17 09:24:34 -08:00
Aleix Pol
8a019ccddf Fix assert 2015-12-17 17:58:33 +01:00
Albert Vaca
7ed012e4a5 Fixed broadcast 2015-12-17 08:59:08 -08:00
Albert Vaca
f5404ea11b Removed more references to publicKey 2015-12-17 08:22:18 -08:00
Albert Vaca
918bb82ffa Do not store certificate and key in landevicelink
The socket already stores the certificate, and the public key is only used
in the sftp plugin, so it should be moved there or dropped.
2015-12-17 07:46:13 -08:00
Albert Vaca
4c84499e6a Don't addLink twice for the same link 2015-12-17 07:44:29 -08:00
Albert Vaca
dd7d4093ed Removed sendPackageEncrypted from DeviceLink 2015-12-17 07:43:52 -08:00
Albert Vaca
d37830b429 Simplified pairing logic 2015-12-17 06:54:29 -08:00
Albert Vaca
10b4ca00fb Set certificate in outgoing pairing packet 2015-12-17 06:53:57 -08:00
Albert Vaca
af43a21864 Propagate pairingError 2015-12-17 06:53:29 -08:00
Albert Vaca
49a24c258b Fixed crash 2015-12-17 05:54:24 -08:00
Albert Vaca
813c9fedb3 Calling setDeviceLink in pairing handler is not required anymore
Since we re-use the same device link object forever now
2015-12-17 04:41:53 -08:00
Albert Vaca
ddca4d6d63 Store and restore certificate and public key in lan link 2015-12-17 04:41:10 -08:00
Albert Vaca
79a8103120 Added some asserts 2015-12-10 19:06:55 -08:00
Albert Vaca
2e4c3762e9 Re-use landevicelink objects instead of re-creating one each time 2015-12-10 17:11:48 -08:00
Albert Vaca
2e4ce90656 Commented out old encryption functions 2015-12-07 03:34:41 -08:00
Aleix Pol
d69cdce4c1 Make sure incoming Lan pair packages are processed by the LanPairHandler 2015-12-06 02:12:29 +01:00
Aleix Pol
7041c72aed Fix connect 2015-12-06 02:11:50 +01:00
Aleix Pol
e10b2e80c9 Propagate pairing errors 2015-12-06 01:51:53 +01:00
Aleix Pol
90c8f588bc Only respond to local broadcasts 2015-12-06 01:19:55 +01:00
Aleix Pol
69d899ed48 Only broadcast when the newly reported configuration is actually active 2015-12-06 01:19:20 +01:00
Albert Vaca
03926cc3bf WIPx4 2015-12-02 11:04:35 -08:00
Albert Vaca
af5be6e9e0 Added a test mode to lanlinkprovider
Should fix tests when you run them on networks with real kdeconnects
running.
2015-12-02 09:49:00 -08:00
Albert Vaca
cf6cbd2925 WIPx3! 2015-12-01 10:45:14 -08:00
Albert Vaca
82bc73dd9b WIPx2 2015-12-01 07:25:34 -08:00
Albert Vaca
16f9af908a WIP 2015-11-30 10:36:01 -08:00
Albert Vaca
30d2dd991b Merge branch 'master' into sslmaster 2015-11-30 03:40:07 -08:00
Aleix Pol
0bca50af93 Merge branch '0.9' 2015-10-19 17:48:13 +02:00
Albert Vaca
d2b4a6f214 Indentation 2015-10-18 21:51:51 -07:00
Albert Vaca
e2f068b286 Fixed a memory leak making the DownloadJob destroy itself on disconnect
There are still some code paths where it doesn't get destroyed though,
like when the device gets unreachable (and the download socket doesn't
close for some reason).
2015-10-18 21:51:51 -07:00
Albert Vaca
229e3aa070 Removed unused class 2015-10-18 19:42:40 -07:00
Vineet Garg
646196b3eb Added loopback pairing handler 2015-09-14 16:36:04 +05:30
Vineet Garg
73a80f0296 Fixed Lan Link Provider Test
Pairing timer was started even when pair package sending is failed, fixed that
2015-09-13 01:45:19 +05:30
Aleix Pol
f7423c6ad6 Better use of error information 2015-09-12 09:47:47 +02:00
Aleix Pol
4730022810 Pass arguments as const-reference 2015-09-12 09:45:59 +02:00
Aleix Pol
5e0a7a34b9 Merge branch 'master' into ssl
# Conflicts:
#	cli/kdeconnect-cli.cpp
#	core/backends/lan/landevicelink.cpp
#	core/backends/lan/landevicelink.h
#	core/backends/lan/lanlinkprovider.cpp
#	core/backends/lan/lanlinkprovider.h
#	core/backends/lan/socketlinereader.h
#	core/backends/lan/uploadjob.cpp
#	core/backends/lan/uploadjob.h
#	core/backends/loopback/loopbackdevicelink.h
#	core/daemon.cpp
#	core/daemon.h
#	core/device.cpp
#	core/device.h
2015-09-11 17:25:23 +02:00
Patrick von Reth
da5c9bd30e Fix compilation on Windows. 2015-09-10 15:51:38 +02:00
Aleix Pol
4cccb7344a ++verbosity on error 2015-09-09 20:12:16 +02:00
Aleix Pol
26b0ec8b98 Make sure we don't disconnect from discovering remotes
Otherwise it's hard to let other devices connect to us, without having both
devices in discoverability mode.

Reviewed by Albert Vaca
2015-09-09 13:01:38 +02:00
Aleix Pol
817fcbc9d6 Merge branch 'stable' 2015-09-08 10:51:41 +02:00
Aleix Pol
d58f6314fe run Clang Modernize
Minus the auto change
2015-09-08 10:47:37 +02:00
Aleix Pol
4023bf0599 Only keep connections alive with unpaired devices when discovery is enabled
At the moment, we were keeping the connection alive with every reachable
device. While this works optimally for most use-cases, on networks with
several devices with KDE Connect, the amount of connections grows
exponentially.

Reviewed by Albert Vaca

CCBUG: 352424
2015-09-08 09:30:55 +02:00
Aleix Pol
774893d3f9 cleanup
make attribute const
construct when initializing
no need to have all methods as slots
2015-09-08 09:22:31 +02:00
Aleix Pol
e1be5319f5 Only broadcast again if the network configuration actually changes
Reviewed Albert Vaca
2015-09-08 09:05:06 +02:00
Aleix Pol
f65a1f206f Turn core qWarnings into qCWarning 2015-09-07 19:35:07 +02:00
Aleix Pol
d835d01a09 Add a test for file sending, using the loopback device
Extends unit testing by making sure that file sharing works locally.

REVIEW: 125086
2015-09-07 15:03:04 +02:00
Vineet Garg
78e9c08732 Merge branch 'master' into ssl
Conflicts:
	core/backends/lan/socketlinereader.h
	core/backends/lan/uploadjob.h
	core/networkpackage.h
2015-08-25 03:43:41 +05:30
Vineet Garg
17da38e5ba Explicity using TLSv1 because using AnyProtocol causes a default TLSv1.2 handshake which not supported on older android version
Was using QueryPeer instead of VerifyPeer of isDeviceTrusted of connected slot
2015-08-25 01:14:24 +05:30
Boris Egorov
1924173df2 Fix various krazy2 warnings
Fix following krazy2 warning types:
[explicit], [endswithnewline], [doublequote_chars], [includes], [normalize],
[postfixop], [spelling]

See http://ebn.kde.org/krazy/reports/playground/base/kdeconnect-kde/index.html
for details.

SLOT/SIGNAL normalization done with Qt normalize utility:
https://github.com/qtproject/qtrepotools/tree/master/util/normalize

REVIEW: 124857
2015-08-21 22:38:54 +06:00
Vineet Garg
44c0ec1c78 If remote device certificate is changes, in sslError due to simulataneous multiple connections, unpair was called on null pointer 2015-08-17 20:04:41 +05:30
Vineet Garg
eff84a49d4 We support any protocol instead of TLSv1.2 2015-08-16 21:19:56 +05:30
Vineet Garg
75bd15ed65 Added default value while checking for link name in pairing handler, this provides backward compatibility 2015-08-14 17:33:08 +05:30
Vineet Garg
6fe1399a18 Fixed minor issues in pairing handler 2015-08-13 14:56:28 +05:30
Vineet Garg
cf3d37b504 Fixed issue pointed out on RR
Fixed some pairing handler issues
2015-08-11 09:04:02 +05:30
Vineet Garg
2824e73617 Pairing handler implemented 2015-07-27 20:58:58 +05:30
Vineet Garg
27515546a0 Now per device per link type pairing handlers are there 2015-07-25 17:15:19 +05:30
Vineet Garg
20e46418ba Encryption info in cli 2015-07-18 18:54:10 +05:30
Vineet Garg
e6da860fb7 Fixed issues pointed out on CR 2015-07-14 17:34:04 +05:30
Vineet Garg
781adac15b Removed whitespace 2015-07-13 19:55:22 +05:30
Vineet Garg
1ba68150a7 Made server like normal QTcpServer 2015-07-10 03:57:27 +05:30
Vineet Garg
7c777e6279 Implemented pairing handler interface 2015-07-10 03:21:08 +05:30
Vineet Garg
e7617f3da9 Use Q_DECL_OVERRIDE in server 2015-07-08 02:45:59 +05:30
Vineet Garg
8b0f06e484 Code cleanup, fixed socket deletelater issue 2015-07-08 00:22:10 +05:30
Vineet Garg
b6b5257ba4 Added ssl support in download job 2015-07-06 03:19:58 +05:30
Vineet Garg
0c110e4392 Added SSL encryption in file upload
DeviceId is used for peerVerifyName
2015-07-06 02:35:26 +05:30
Vineet Garg
148a713176 Initial working implementation of ssl 2015-07-05 18:53:53 +05:30
Albert Vaca
2dab79bc3f Fixed warning. 2015-06-15 09:03:26 -07:00
Albert Vaca
09557b8a14 Moved network change detection from daemon to lanlink 2015-06-14 13:54:52 -07:00
Àlex Fiestas
ba4c87abc1 Consume all pendingDatagrams from udpServer
This fixes a bug where receiving broadcast messages would stop working
in case 2 messages have been received at the same time.

The problem is that readReady will only emit once per batch of datagrams
received, in case we receive 2 datagrams but only consume 1, readReady
will never be emitted again.
2015-05-05 01:04:50 +02:00
Albert Vaca
fbbaa854b2 Const 2015-04-04 19:03:24 -07:00
Albert Vaca
dacaee6629 Fixed daemon sending lots of identity packets at startup
The way we were detecting the active network interfaces caused to detect
all of them at the application startup.
2015-04-04 16:32:15 -07:00
Albert Vaca
6c6f2b1a03 Fixed uninitialized members 2015-04-04 10:17:08 -07:00
Albert Vaca
a5e5b10d9a Code styling 2015-03-21 23:12:04 -07:00
Albert Vaca
a649bb5668 Added some error messages when ports are not available 2015-03-21 23:11:50 -07:00
Albert Vaca
a3decd542c Includes cleanup 2015-03-13 21:20:58 -07:00
Albert Vaca
c7c91c1289 Added KdeConnectConfig class that aims to be a KConfig abstraction
Benefits:
- We had config files in different paths, now they will be centralized.
- Daemon, LanLinkProvider and NetworkPackage depend only on Qt now.
- KConfig is accessed with strings as keys, where a typo can go unnoticed.
- Daemon is now thinner, as it doesn't need to initialize config values.
- QCA::Initializer is in a single place now (was in Daemon and Plugin).
2015-03-01 20:16:07 -08:00
Albert Vaca
aaa034b9d6 Removed reference to KDED 2015-02-23 22:14:22 -08:00
Albert Vaca
c7c1974ea9 Merge branch 'master' into frameworks
Conflicts:
	core/backends/lan/lanlinkprovider.cpp
	plugins/ping/pingplugin.h
	plugins/telephony/telephonyplugin.cpp
2015-01-10 20:14:01 -08:00
Albert Vaca
4b6aa135e3 Fixing memory leaks in LanDeviceLinkProvider and LanDeviceLink 2015-01-06 21:48:25 -08:00
Pramod Dematagoda
6926fca598 Adjust socket parameters to detect device disconnection faster.
REVIEW: 121711
2014-12-29 23:34:03 -08:00
Albert Vaca
9266094747 Removed unused vars 2014-11-29 00:17:42 -08:00
Albert Vaca
a58fab4fb3 Merge branch 'master' into frameworks
Conflicts:
	cli/kdeconnect-cli.cpp
	core/device.cpp
	core/filetransferjob.cpp
	core/filetransferjob.h
	core/networkpackage.h
	kded/CMakeLists.txt
	plugins/share/shareplugin.cpp
	plugins/telephony/telephonyplugin.cpp
2014-11-11 21:40:54 -08:00
Jens Dagerbo
53a33096ad Changed int to qint64 for tracking payload size
No longer keeping the entire file in RAM while uploading
2014-11-09 12:57:09 -08:00
Aleix Pol
21ab5a4f81 Merge branch 'master' into frameworks
Mostly kDebug -> qCDebug
Also some KCmdLineArgs -> QCommandLineParser

Conflicts:
	cli/kdeconnect-cli.cpp
	core/CMakeLists.txt
	core/backends/lan/lanlinkprovider.cpp
	core/daemon.cpp
	core/pluginloader.cpp
	interfaces/CMakeLists.txt
	kio/kiokdeconnect.cpp
	plugins/mousepad/CMakeLists.txt
	plugins/mousepad/mousepadplugin.h
	plugins/mpriscontrol/mpriscontrolplugin.cpp
	plugins/sftp/sftpplugin.cpp
2014-11-04 19:12:29 +01:00
Albert Vaca
279dbe5598 Minor changes 2014-10-10 11:47:35 -07:00
Albert Vaca
ddb9190fbe More robust fix to problem with device ids being non exportable on dbus 2014-10-10 11:26:50 -07:00