Commit graph

46 commits

Author SHA1 Message Date
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
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
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
Nicolas Fella
87db95b22f Convert license headers to SPDX expressions 2020-08-17 09:48:10 +00:00
Nicolas Fella
950366092b Remove modeltest
It's only a development tool and there's a more modern alternative: https://doc.qt.io/qt-5/qabstractitemmodeltester.html
2020-08-14 14:01:19 +02:00
Antonio Larrosa
1d36164230 Use ecm_qt_declare_logging_category to declare the logging categories
This automatizes the generation of logging categories so a
kdeconnect-kde.categories is generated and installed to
/usr/share/qlogging-categories5/ so kdebugsettings can use it.

Also, sets the default logging level to Warning. So now the logs
of users won't be filled with debug messages but they can
modify the configuration easily with kdebugsettings.
2020-05-26 18:55:47 +02:00
Nicolas Fella
8620db19ba Remove usused includes 2020-01-20 17:45:36 +01:00
Nicolas Fella
b407571ef1 Fix coding style 2019-10-20 01:49:14 +02:00
Nicolas Fella
0d7c504cf0 Rename DbusHelper => DBusHelper 2019-08-14 17:36:19 +02:00
Weixuan Xiao
5431073844 Add wrapper for macos dbus connection 2019-06-09 15:28:49 +00:00
Nicolas Fella
850bdf6cc9 Replace qVariantFromValue with QVariant::fromValue 2019-05-09 23:30:26 +02:00
Nicolas Fella
5e5275ffb8 Revert "QtGui is not needed in interfaces"
It breaks icons in several places

This reverts commit 2538a6a3e6.
2019-03-24 17:12:42 +01:00
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
fef658eba7 Remove stray include 2019-03-11 18:26:35 +01:00
Nicolas Fella
74e7a90cd8 Simplify notification handling
Summary:
Use QPointer for KNotification
Use ready signal for signalling updates

BUG: 400010

Test Plan: Spawned some notifications

Reviewers: #kde_connect, broulik, albertvaka

Reviewed By: #kde_connect, albertvaka

Subscribers: albertvaka, kdeconnect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D18354
2019-01-24 09:19:14 +01:00
Adam Pigg
9a8f1b48a0 Build kdeconnect on sailfish and port some simple plugins
Summary:
Below is a lost of the commits, but, in summary
Port the build system for Sailfish, which means selectively building only the bits we need/can, and only against the KF5 libs that are available.
Allow to build on Qt 5.6
Switch from knotification to nemo notification (not complete!)
Add a very simple example sailfish app.

Note, there is still much missing functionality.  Notifications dont work, pairing sort of works but not really, but when it is paired you can send a ping to the desktop client

Dont build kio for Sailfish

Port core build system

Port daemon buld system

Require CoreAddons on Sailfish

Port plugins build for sailfish and include the ping plugin for now

Final build changes for sailfish.

Disable tests and other not needed parts

Add includes for QCA

Fix build errors on sailfish

Get core/ to build on sailfish

Get interfaces/ to build on sailfish

Build daemon on sailfish

On sailfish, dont install the kcm file

Start port plugin to sailfish

Fixup installed files

Add sfos app

Hack declarative plugin to give a public interface

Build sfos app

Compile declarativeplugin into the sfos app for now

Redefine qAsConst for qt 5.6

Packaging fixes

Use official icon

Package .desktop

Reviewers: #kde_connect, apol, nicolasfella, albertvaka

Reviewed By: #kde_connect, apol, nicolasfella, albertvaka

Subscribers: kdeconnect, andyholmes, albertvaka, kossebau, mtijink, vonreth, apol, #kde_connect, nicolasfella

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D10703
2018-08-02 20:10:59 +01:00
Thomas Surrel
628afdeb1e Add new notifications at the top of the list
Summary:
This will show a list with the most recent notifications at the top, in the
plasmoid.

This is more consistent with the KDE notification plasmoid that stack them like
this too.

Reviewers: apol, #kde_connect

Reviewed By: apol, #kde_connect

Subscribers: kdeconnect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D13540
2018-07-12 16:17:12 +02:00
Albert Vaca
f47f517827 Rename NetworkPackage -> NetworkPacket
Summary: KDE Connect, now with correct naming!

Test Plan: It still builds.

Reviewers: #kde_connect, apol, nicolasfella

Reviewed By: #kde_connect, apol, nicolasfella

Subscribers: nicolasfella

Differential Revision: https://phabricator.kde.org/D11036
2018-03-05 20:03:23 +01:00
Nicolas Fella
fbf8852d6f Fix Notifications in Plasmoid
Summary:
Fixed Issues mentioned in https://phabricator.kde.org/T6729
This patch also fixes a crash when the filetransfer of the icon fails

Test Plan:
Receive a notification with a previously unknown icon -> icon in Plasmoid is displayed correctly
Receive a notification with an already existing id -> notification in Plasmoid is updated

Reviewers: #kde_connect, apol

Reviewed By: #kde_connect, apol

Subscribers: albertvaka, broulik, apol, #kde_connect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D7209
2017-11-06 04:15:50 +01: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
Nicolas Fella
5d4821fb9c Only show notification title in plasmoid if different to app name
Summary: Like we do for the notifications in the plugin already. Passing the title and text separately to the plasmoid could be useful later as well.

Reviewers: #kde_connect, albertvaka

Reviewed By: #kde_connect, albertvaka

Subscribers: #kde_connect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D7457
2017-08-22 18:18:34 +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
Julian Wolff
8aaa18848e show icon and reply toolbutton in plasmoid
Summary:
Show an icon for each notification which has an icon.

	Show a toolbutton which can be used to reply to notifications which offer a quick reply.

Reviewers: #kde_connect, albertvaka

Reviewed By: #kde_connect, albertvaka

Subscribers: albertvaka

Maniphest Tasks: T4674, T4658

Differential Revision: https://phabricator.kde.org/D6058
2017-06-01 16:17:45 +02: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
7c0fbbc034 Unused include cleanup 2016-07-05 14:13:48 +02:00
David Kahles
aefa51fa86 Remove notifications from plasmoid, if the notifications plugin gets disabled
Therefore notify the client that we're deleting all notifications.
Otherwise the client wouldn't notice this and the notifications would still
be available in the plasmoid.

REVIEW: 127582
2016-04-06 02:30:50 +02:00
David Kahles
12ccbaef98 Improve NotificationsModel
Don't refresh the whole notification list, if a notification is added or
removed.

REVIEW: 127565
2016-04-05 23:33:45 +02:00
David Kahles
a8bd062baf Stop clearing the notification list twice
There were two clearNotifications() calls when refreshing the notification
list. As there happens nothing relevant in between them, the second call is
useless.

REVIEW: 127542
2016-04-05 23:33:45 +02:00
Aleix Pol
b1692142b1 Polish NotificationsModel::isAnyDismissable proprety
Let qml know it's computed on every call.
Consider it might have changed whenever a new notification enters as well.
2015-11-12 12:27:30 +01: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
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
Albert Vaca
f21746cfae Returning a QIcon instead of a fixed size QPixmap for DecorationRole. 2015-04-19 22:21:37 -07:00
Aleix Pol
28bc226e5d Make the NotificationsModel also async
The code was almost identical to the one in DevicesModel, so I did the same
2015-03-14 05:37:16 +01:00
Albert Vaca
6cc6d287fc Merge branch 'master' into frameworks
Conflicts:
	cli/kdeconnect-cli.cpp
	core/filetransferjob.cpp
	core/filetransferjob.h
	interfaces/notificationsmodel.cpp
	plasmoid/declarativeplugin/kdeconnectdeclarativeplugin.h
	plugins/sftp/sftpplugin.cpp
2015-01-20 22:44:31 -08:00
Albert Vaca
da1cb4c354 Coding style 2015-01-20 22:22:14 -08:00
Albert Vaca
91d4a03258 Made notification id accessible from QML 2015-01-20 22:17:01 -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
Lukáš Tinkl
994057af0e fix the Configure action
display the kdeconnect kcm
2014-09-10 10:19:44 +02:00
Albert Vaca
12411da360 Added some debug info to devices and notifications models 2014-07-01 01:26:08 +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/notificationsmodel.cpp (Browse further)