Commit graph

49 commits

Author SHA1 Message Date
Nicolas Fella
3b8fedea1a Replace http GNU urls with https 2019-03-23 17:29:26 +01:00
Nicolas Fella
2538a6a3e6 QtGui is not needed in interfaces 2019-03-13 01:23:16 +01:00
Nicolas Fella
2e26abbd18 Revert "Allow accessing deviceName from qml"
This reverts commit e47fb17006.

It broke the name in various QML places because display was not available as a role any more. The ones inside KDE Connect were easily fixed, but Purpose is hard to fix
in a fully compatible way
2018-11-26 15:48:35 +01:00
Billy Laws
e47fb17006 Allow accessing deviceName from qml
Summary: This allows it to be used outside of comboboxes in qml

Reviewers: broulik

Reviewed By: broulik

Subscribers: broulik, kdeconnect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D16829
2018-11-11 19:28:45 +00:00
Jean Vincent
72535ecf48 Make member variable names, & placement and * placement more coherent
Summary:
Change all member variables to the form m_fooBar because it is the preferred form in Qt (it was half and half between this and mFooBar, and a minority didn't have anything).
Place all references and pointers on the side of the type since it is the majority.

Basically:
 - mFoo -> m_foo
 - foo -> m_foo (if it is a member variable)
 - Type &ref -> Type& ref
 - Type *ptr -> Type* ptr

Reviewers: #kde_connect, nicolasfella, albertvaka

Reviewed By: #kde_connect, nicolasfella, albertvaka

Subscribers: albertvaka, #kde_connect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D7312
2017-09-03 21:45:08 +02:00
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
Aleix Pol
b1f6204c53 Hint a size for the delegate 2016-11-28 16:27:34 +01:00
Albert Vaca
1a1f94fd94 Fixed old style connects with clazy 2016-11-26 15:12:38 +01:00
Aleix Pol
8b523ad59a We want the discovery mode active when the reachable devices are needed 2016-06-06 01:21:37 +02:00
Albert Vaca
0c95010c3b Merge branch 'master' into sslrefactor
# Conflicts:
#	core/device.cpp
#	interfaces/devicesmodel.cpp
2016-04-14 19:00:42 -07:00
David Kahles
3103bd0c5a Improve filtering of devices in the DevicesModel
We need to remove devices from the model if the filter doesn't match, to
prevent listing disconnected devices in the plasmoid.

REVIEW: 127610
2016-04-08 17:01:33 +02:00
David Kahles
6cc1946443 Allow paired and not reachable devices in the model
The server supports this device state (e.g. if a device was saved as paired,
but isn't reachable), so let's expose it to the model.
The display filter should take care of excluding such devices if
nessecarry.
To make sure that such devices aren't shown in the kcm (we can't do anything
useful with them at the moment), set the display filter accordingly.

REVIEW: 127553
2016-04-05 23:33:45 +02:00
Albert Vaca
cf6cbd2925 WIPx3! 2015-12-01 10:45:14 -08:00
Aleix Pol
a9d2840664 Use acquire and release instead of a boolean property
This way we hope we won't end up without discovery if 2 instances need
discovery at the same time.

Reviewed by Albert Vaca
2015-09-09 20:09:04 +02:00
Aleix Pol
d58f6314fe run Clang Modernize
Minus the auto change
2015-09-08 10:47:37 +02:00
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
Lamarque V. Souza
208c11de1a Fix battery widget not appearing after kdeconnectd restarts.
I also added a workaround to prevent memory leak described in
0f38eb34a4.

REVIEW: 124361
2015-07-17 00:40:45 -03:00
Aleix Pol
06493a8192 Keep track of whether the daemon is alive
Listen to dbus registrations. Remove all devices if the service dies,
create all devices back when restored.
Same for the NotificationsModel.

REVIEW: 124183
2015-06-25 21:19:23 +02:00
Aleix Pol
43451d6ae1 Simplify Device::id management
Removes the id->row mapping. It was broken as the indices weren't updated
when a row was added or removed.
Stop exposing Device::id through dbus, just store it in the interface
class.
* It's redundant as it's part of the interface definition
* If we keep it it will save us quite some dbus round-trips
* It will be reliable, as nowadays id() sometimes QString() if the dbus
connection is invalid.

REVIEW: 124158
2015-06-24 20:57:17 +02:00
Albert Vaca
9fa8538bf1 Removed some assertions that could not be true if using the model filter
Also fixed ugly hack where the KCM updated the model
2015-06-21 20:20:40 -07:00
Albert Vaca
fd65570487 Some TODOs done :)
Also renamed the Status flags enum to make it more understandable
2015-06-21 19:42:16 -07:00
Aleix Pol
46b57003cd Display the device model section
This way we can differentiate between the different states
2015-06-19 07:14:02 +02:00
Aleix Pol
6ddac08978 Introduce a device Role
REVIEW: 124067
2015-06-11 16:47:53 +02:00
Albert Vaca
e5b897884c Added device status icons to be used in the KCM instead of the IM ones 2015-05-17 23:28:58 -07:00
Albert Vaca
50f611f8e3 IconModelRole now uses IconNameModelRole 2015-05-17 18:48:10 -07:00
Albert Vaca
519d67023c Added tooltip to model 2015-05-17 18:47:31 -07:00
Albert Vaca
f21746cfae Returning a QIcon instead of a fixed size QPixmap for DecorationRole. 2015-04-19 22:21:37 -07:00
Aleix Pol
05491442e6 Make it possible to fetch the device from the DevicesModel from QML
Uses the row as the argument instead of the QModelIndex.
Defines the Device type so it can be used from QML.

REVIEW: 123361
2015-04-15 13:00:23 +02:00
Albert Vaca
b5420048f9 Fixed warning 2015-03-23 20:44:18 -07:00
Aleix Pol
fda4556dfc Take into account the integrated filter in the DevicesModel 2015-03-16 02:31:59 +01:00
Aleix Pol
6fe7a9b158 Make it possible for the DevicesModel to react to device name changes 2015-03-14 04:28:54 +01:00
Aleix Pol
bb97cc19b6 Don't try to initialize the devices model with an empty list 2015-03-14 04:28:06 +01:00
Aleix Pol
fb9143a2aa Ensure the watcher never leaks 2015-03-14 04:27:30 +01:00
Aleix Pol
b99cba1949 Make the DevicesModel::deviceAdded code more robust
If deviceAdded is reported even though it's already in the model, don't
add it twice.
2015-03-14 03:40:01 +01:00
Aleix Pol
e592081094 Fix issue spotted by modeltest
Off by 1 index... :(
2015-03-14 03:32:53 +01:00
Aleix Pol
7d6cf97551 Treat dbus errors are warnings rather than debug information
Hopefully it will make it easier to pick up at some point.
2015-03-14 02:42:18 +01:00
Aleix Pol
5d1750b716 Implement TODO
When a device is added, just add the new device instead of refreshing the
whole list.
2015-03-14 02:32:38 +01:00
Aleix Pol
7af7dbdc2f Improve DevicesModel::receivedDeviceList
Make the population asynchronous on dbus. Wait for the device list and
don't populate it until it's ready. There's no reason to block.
Don't emit after endInsertRows. It doesn't help, as the views will have
already refreshed.
2015-03-14 02:30:35 +01:00
Aleix Pol
128241c95c Don't call the QString copy constructor without need 2015-03-14 02:20:25 +01: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
Aleix Pol
968ccb22c6 Port away from deprecated setRoleNames 2014-09-23 19:27:47 +02:00
Àlex Fiestas
02fd748f41 Interfaces no longer depend on kdelibs4support
Also since fileitemactionplugin was using them (and inhering
kdelibs4support) not we have tu explicitly link against it in there.
2014-09-22 00:16:39 +02:00
Àlex Fiestas
42269a9dda Port from KIcon to QIcon
Executed kcm and some notifications, icons are still shown.
2014-09-13 01:04:48 +02:00
Albert Vaca
12411da360 Added some debug info to devices and notifications models 2014-07-01 01:26:08 +02:00
Albert Vaca
d72ebc4cf7 Workaround to make devices be correctly filtered again.
Flags in QML are not working correctly (as they are in Qt5), so we will
use integer values for the flags for now.
2014-07-01 01:26:07 +02:00
Aleix Pol
446dbbc230 Remove IsPairedRole
It was not a good idea
2014-06-27 16:16:45 +02:00
Aleix Pol
dc2f9c0f3c Introduce a IsPaired role in the DevicesModel
Reviewed by Albert Vaca
2014-06-23 18:13:43 +02:00
Aleix Pol
b7420146eb Expose the icon name from the device instance 2014-06-14 19:42:34 +02:00
Aleix Pol
b88897847b Reorganize sources
We broke kded into core and kded, core contains the library with the backends
and plugins.
Also we renamed libkdeconnect to interfaces.
2014-06-14 15:22:40 +02:00
Renamed from libkdeconnect/devicesmodel.cpp (Browse further)