Commit graph

140 commits

Author SHA1 Message Date
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
Albert Vaca Cintora
e7518493df Add a verification key that's displayed when pairing
The key is a sha256 of both devices' certificates. Both should generate the
same key, so hey user can check they are pairing against the right device.

Thanks Matthias Gerstner <mgerstner@suse.de> for reporting this.
2020-11-26 11:28:49 +01:00
Nicolas Fella
87db95b22f Convert license headers to SPDX expressions 2020-08-17 09:48:10 +00:00
Richard Liebscher
f3656d962c Save changed device name and type 2020-08-02 18:34:02 +02: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
Albert Astals Cid
9405cb58b0 Add NOTIFY signal to statusIconName property
Device::statusIconName depends on isReachable() and isTrusted()

Not sure how the property is used but it's good that they have a NOTIFY is defined if it's needed for completion
2019-07-21 15:57:38 +00:00
Albert Vaca Cintora
1e9a0f6808 Add braces 2019-07-05 00:13:55 +02:00
Nicolas Fella
e601755644 Force usage of QStringLiteral and port remaining offenders 2019-06-10 14:40:28 +00:00
Weixuan Xiao
5431073844 Add wrapper for macos dbus connection 2019-06-09 15:28:49 +00:00
Nicolas Fella
c4bc7c567d Don't allow to enable nonexistant plugins 2019-05-10 22:20:12 +00:00
Nicolas Fella
3b8fedea1a Replace http GNU urls with https 2019-03-23 17:29:26 +01:00
Nicolas Fella
bd17dc2041 Fix container detach warnings from clazy
Reviewers: #kde_connect, apol

Reviewed By: #kde_connect, apol

Subscribers: apol, kdeconnect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D17164
2018-11-26 13:21:39 +01:00
Nicolas Fella
e4385042eb Show icons in plugin list
Summary:
Show the plugin's icons in the list

Depends on D14567

{F6172885}

Reviewers: #kde_connect, apol

Reviewed By: #kde_connect, apol

Subscribers: kdeconnect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D14571
2018-08-03 02:25:39 +02: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
Caio Carvalho
4097b6f71f Including d-pointer in Device class
Summary:
Including d-pointer pattern in Device class.

Related to this task: https://phabricator.kde.org/T6805

Reviewers: #kde_connect, nicolasfella

Reviewed By: #kde_connect, nicolasfella

Subscribers: nicolasfella, kdeconnect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D12863
2018-05-15 19:15:05 -03:00
Yoann Laissus
c6ebdbe89b Add detection of Android TV devices with a proper icon
Android app :  https://phabricator.kde.org/D12803

Test Plan: Tested with an Android TV device (Nvidia Shield)

Reviewers: #kde_connect, nicolasfella

Reviewed By: #kde_connect, nicolasfella

Subscribers: kdeconnect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D12802
2018-05-10 17:55:55 +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
b6972e4cb9 Replace qSort with std::sort 2018-02-26 20:41:25 +01:00
Albert Vaca
84bba9429f Merge branch 'master' into 1.x
# Conflicts:
#	core/backends/lan/downloadjob.cpp
#	core/backends/lan/downloadjob.h
#	core/filetransferjob.cpp
#	core/filetransferjob.h
#	plugins/notifications/sendreplydialog.cpp
#	plugins/notifications/sendreplydialog.h
#	plugins/telephony/sendsmsdialog.cpp
#	plugins/telephony/sendsmsdialog.h
2017-09-03 22:05:54 +02: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
Albert Vaca
ef0e80c91f Merge branch 'master' into 1.x
# Conflicts:
#	indicator/org.kde.kdeconnect.nonplasma.desktop
#	org.kde.kdeconnect.kcm.appdata.xml
#	plugins/runcommand/kdeconnect_runcommand.json
#	urlhandler/org.kde.kdeconnect.telhandler.desktop
2017-07-24 16:49:06 +02:00
Jean Vincent
25b86c6c7f Determine which IP address to use for sshfs
Summary:
There is currently an issue where the device doesn't send the correct IP address for sshfs when a VPN is present.

Instead of asking the device to find and send its address, we can store it from when the device link is created then reuse it.

Test Plan:
All unit tests pass.

In these different situations:
  - without a VPN
  - with a VPN running
  - with a VPN started then stopped (the tun interface might still be there)
Try to remotely browse the device. It should work in all cases.

Reviewers: #kde_connect, albertvaka

Reviewed By: #kde_connect, albertvaka

Subscribers: albertvaka, apol, nicolasfella, sredman

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D6730
2017-07-22 11:18:06 +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
d7ec24725f Make sure we keep track of changes when the device link changes
Especially useful because it contains the announce name.

CCBUG: 364150
2017-07-14 03:30:49 +02:00
Aleix Pol
209e3e2842 Reflect property change when unpairing
There's no pairStatusChanged when the device is not connected to
anything (be it because it's unreachable at the moment).
2017-07-14 01:01:15 +02:00
Aleix Pol
f65392ca6b Expose pair requests on the KCM 2017-02-20 21:00:26 +01:00
Albert Vaca
768fdb443f Fixed sftp plugin
Scriptable slots show be exposed on dbus
2017-01-27 01:39:03 +01:00
Aleix Pol
6c77bc5a9f Debug pairing handlers
Make sure we don't emit if it doesn't actually change
Make sure if it changed when we react to a pairing

Pair-programmed with Albert Vaca
2017-01-25 01:18:14 +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
Albert Vaca
461874f4a5 Comment got displaced 2017-01-14 02:50:25 +01:00
Aleix Pol
c038c41eec Remove unused enum 2017-01-13 17:48:37 +01:00
Holger Kaelberer
8c9253440d Export scriptable plugin signals
A plugin should have the possibility to define signals to be exposed
on dbus.

REVIEW: 129811
2017-01-13 08:05:35 +01:00
Aleix Pol
3734d6ce4d Reduce API exposed through dbus
Summary:
Don't use QDBusConnection::ExportAllContents
No need to make connect and receivedPackage public slots (they're are the
parent's already)

Fixes T4975

Test Plan: Rough manual test

Reviewers: #kde_connect, albertvaka

Reviewed By: #kde_connect, albertvaka

Maniphest Tasks: T4975

Differential Revision: https://phabricator.kde.org/D3871
2017-01-10 18:15:01 +01:00
Aleix Pol
e72bbfe1d2 Remove dash in icon
We use it to display the state and we're providing them as fallback,
they will always be available.
Otherwise, on some platform this clashes with the icon engine falling
back to less specific version of the icon (i.e. smartphone instead of
smartphone-connected).

https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html

Reviewed by Albert Vaca
2016-11-28 16:27:34 +01:00
Albert Vaca
3df5e0dc11 Define the debug category in core_debug.cpp 2016-11-28 15:57:58 +01:00
Albert Vaca
6a2a0b1c76 Merge branch '1.x'
# Conflicts:
#	plugins/mpriscontrol/mpriscontrolplugin.cpp
#	plugins/sendnotifications/kdeconnect_sendnotifications.json
2016-11-26 16:40:24 +01:00
Albert Vaca
f41883f2f3 Known size, reserve. 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
1a1f94fd94 Fixed old style connects with clazy 2016-11-26 15:12:38 +01:00
Albert Vaca
3d0f7c3fcb Changed signal reachableStatusChanged() to reachableChanged(bool)
And proxied it on the C++ dbus interface.
2016-11-23 17:24:35 +01:00
Albert Vaca
f901655ef4 Warning 2016-11-16 21:37:07 +01:00
Kai Uwe Broulik
6f7c419baa Merge branch '1.x' 2016-09-10 22:53:37 +02:00
Albert Vaca
b585e4d48a Don't return an empty list of supported plugins
If we don't know it yet return them all.
2016-09-06 10:53:19 +02:00
Albert Vaca
5ad007a981 Merge branch '1.x' 2016-08-29 20:46:48 +02:00
Thmoas Posch
a759cdf678 Device::encryptionInfo returned the entire certificate instead of the hash
BUG: 367897
2016-08-29 20:41:06 +02:00
Aleix Pol
f765e9c0a8 Actually compare the old plugin map
We were comparing to the result after removing all the actually used
plugins
2016-08-21 13:21:40 +02:00
Albert Vaca
2cdf7d5499 Reduced logging 2016-07-12 12:49:21 +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