Commit graph

95 commits

Author SHA1 Message Date
Jean Vincent
c864267f04 Replace Q_FOREACH with C++11 range-for
Summary:
The use of Q_FOREACH is advised against (https://doc.qt.io/qt-5/qtglobal.html#Q_FOREACH) since Qt 5.7 and will eventually be removed from Qt.

I replaced all occurrences with the range-for loop introduced in C++11 (except for the one in daemon.cpp in deviceIdByName which might have a bug / typo in it).

I added const to the container or casted it with qAsConst when appropriate to avoid unnecessary copies.

(This is my first submission. I did all the unit tests, and they all passed but I don't know how to show it here.)

Reviewers: #kde_connect, nicolasfella, apol

Reviewed By: #kde_connect, nicolasfella, apol

Subscribers: albertvaka, apol, nicolasfella

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D6724
2017-07-21 09:57:19 +02:00
Pino Toscano
9d968fa3ac Merge remote-tracking branch 'origin/1.x' 2017-05-27 06:29:30 +02:00
Pino Toscano
b6f280aedb tests: fix memory access in testnotificationlistener
set the image data as QByteArray of the right size, otherwise
referencing a stack-based char data will be problematic when the
function is out of scope
2017-05-27 06:14:00 +02:00
Albert Vaca
2c1c8525e5 Now a 100% more compiling 2017-02-14 23:03:59 +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
David Faure
f708b4431d fix compilation with gcc 4.8 2017-01-15 22:12:49 +01:00
David Faure
e59fd940d6 fix compilation with gcc 4.8 2016-12-14 23:36:59 +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
Holger Kaelberer
c122312c65 sendnotifications: also sync icon-data from notfication hints
According to the priorities defined in the notifications spec
version 1.2

REVIEW: 126722
2016-08-27 13:59:25 +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
Aleix Pol
81634303b2 Make capabilities static
As discussed with Albert, move the population of capabilities into the
identity package, making them static along the execution of the link.

When we receive the identityPackage, we collect the plugins we can use with
the device and stick to those. This should simplify the implementation and
remove the possibility to lose packages if packages are received before the
capabilities are processed in the former approach.

REVIEW: 128386
2016-07-06 17:37:22 +02:00
Albert Vaca
8c07d88c17 Int was too large. 2016-07-05 12:28:31 +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
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
49713d8aca Enforce Qt-specific keywords
Reviewed by Albert Vaca
2016-06-21 20:19:14 +02:00
Albert Vaca
e880e14ed5 Preffer Q_FOREACH to foreach 2016-06-21 14:50:17 +02:00
Aleix Pol
bfd698af36 Fix issues detected by clazy
Don't use for(:) on Qt containers. It detaches without need.
2016-06-20 19:22:29 +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
cc0fdacbf5 Fixed compilation on Windows 2016-06-20 02:31:55 +02:00
Albert Vaca
3177143439 Fixed build on windows 2016-06-09 02:36:02 +02:00
Aleix Pol
55c6014686 Fix tests
In case we need to discover the device (i.e. we're running the test in a
clean environment) we need to acquire the discovery mode.
Only initialize the test after setting the test mode enabled, so the
loopback is enabled.
2016-06-06 01:21:37 +02:00
Albert Vaca
0c48c00fa7 Added debug function to print a stack trace 2016-06-01 12:43:34 +02:00
Albert Vaca
04d5b12f8b Merge branch 'master' into sslrefactor 2016-06-01 12:20:07 +02:00
Harald Sitter
f071536649 force a lc_time to make sure the dummyTest passes
if the system locale is not en_US longMonthName might produce a localized
string, failing the qcompare.

REVIEW: 128067
2016-06-01 10:39:13 +02:00
Aleix Pol
a83998dae0 Remove absurd test 2016-06-01 02:29:28 +02:00
Aleix Pol
9aa794b0da Merge branch 'master' into sslrefactor 2016-05-31 17:29:06 +02:00
Albert Vaca
0b5fbe00bb Split plugins for sending and receiving notifications
CCMAIL: holger.k@elberer.de
2016-05-25 12:49:13 -06:00
Albert Vaca
0c95010c3b Merge branch 'master' into sslrefactor
# Conflicts:
#	core/device.cpp
#	interfaces/devicesmodel.cpp
2016-04-14 19:00:42 -07:00
Holger Kaelberer
4b5bde4858 notifications: synchronize icons if possible and requested
Configurably attach icons as payload to notification packages. By
design and due to restrictions on mobile devices *only* png is sent.
As KIconLoader preferably returns svg icons from iconPath() we fall
back to loading from "hicolor" using KIconTheme directly. Otherwise
*many* icons are dropped because of svg format.

This also improves slightly the test-case to use a tweaked TestDevice
to allow for inspecting sent NetworkPackage-s.

REVIEW: 126666
2016-01-11 20:12:43 +01:00
Albert Vaca
fa1771dd64 Merge branch 'master' into sslrefactor 2016-01-10 09:01:14 -08:00
Albert Vaca
aa4150f0c9 Moved ConnectionStarted from DeviceLink to LanDeviceLink 2016-01-10 07:12:13 -08:00
Holger Kaelberer
548508d6e6 notifications: don't register proxied notifications internally
REVIEW: 126645
2016-01-07 13:22:10 +01:00
Albert Vaca
f5404ea11b Removed more references to publicKey 2015-12-17 08:22:18 -08:00
Albert Vaca
77facdbcfd Merge branch 'master' into sslrefactor 2015-12-07 03:38:06 -08:00
Albert Vaca
2e4ce90656 Commented out old encryption functions 2015-12-07 03:34:41 -08:00
Aleix Pol
42110549f4 Improve SharePlugin share notification method
Make the share received notification explicitly internal.
Fix runtime warning about how QUrl cannot be exported.
Notify about all shares, not exclusively transferred files.
2015-12-07 03:27:40 +01:00
Aleix Pol
70f55d0ebc Fix compilation and a couple of warnings
CCMAIL: holger.k@elberer.de
2015-12-07 03:21:35 +01:00
Aleix Pol
a45e48ca7a Fix tests build
Daemon::requestPairing changed into ::askPairingConfirmation.
2015-12-06 00:08:02 +01:00
Holger Kaelberer
4fc39601dd tests: add test-case for NotificationsListener 2015-12-05 23:23:22 +01: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
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
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
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
3269b7a9c2 Fix tests when the Qt mobile app is not built 2015-09-12 15:17:08 +02:00
Aleix Pol
67a2c1ffd9 Properly test to wait for signals 2015-09-11 18:21:18 +02:00