Commit graph

58 commits

Author SHA1 Message Date
Albert Vaca Cintora
7b7a3f41b0 Maybe fix KCM from macos app 2023-03-09 00:35:00 +01: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
12d8adef76 Enable highdpi for all executables 2022-04-02 14:32:54 +02:00
Ryan Adolf
531418c7d2 Change tray icon so it is the right color on MacOS
## Summary

On MacOS the system tray icon is off-color because it uses the gray-colored `kdeconnectindicatordark` icon which does not match the rest of MacOS.

![image](/uploads/430933399d9570dc1c59807e4715e87b/image.png)

BUG: 430226

I've used two patches to fix this:
1. Always use the status `KStatusNotifierItem::Passive` on MacOS. `KStatusNotifierItem` will only mark the icon as a mask (which is needed to allow it to dynamically switch between light and dark theme) [if the status is passive](cff7c337ab/src/kstatusnotifieritem.cpp (L1079-1081)).
2. The above should theoretically be enough to fix the issue and I swear at one point it was all that was needed. However, to fix this issue in my dev environment I also needed to pass in a `QIcon` with `setIsMask(true)` instead of setting the icon by its name. And I also use the `kdeconnectindicator` instead of `kdeconnectindicatordark` icon.

## Test Plan

The icon now renders in the correct color, regardless of whether devices are connected:

![image](/uploads/5010a07cbb5f23a286ece641c6b3879c/image.png) ![image](/uploads/2ae5d3d8aa633ebafb260febe313057c/image.png)

## Future work

Once I've verified this PR is working in the right direction, I want to look into making the icon gray (and hopefully a much easier-to-see gray) when no devices are connected!

For example, WireGuard, when not connected, looks like this:

![image](/uploads/43c2ef6bc7261431e878c9c1c05174f9/image.png) ![image](/uploads/f7587190648606df77ad3e3dde84098f/image.png)

P.S. I've been testing off the v21.12.2 tag since the master branch doesn't compile for me, so I haven't tested this change on the latest dev commit. But there should be no conflicts.
2022-03-02 12:06:36 +00:00
Ryan Adolf
14543fcba5 Raise configuration window (MacOS bug)
## Summary

I've added a call to [`dialog->raise()`](https://doc.qt.io/qt-5/qwindow.html#raise) when launching the configuration dialog.

This is intended to fix a MacOS bug where the configuration window launches behind other open windows, but this call shouldn't harm operating systems as well.

BUG: 416050

## Test Plan

### Before:
Configuration dialog launches behind other open windows on MacOS.

### After:
Configuration dialog launches over other open windows on MacOS.
2022-02-26 10:23:20 +00:00
Alexander Lohnau
fd681e62ab Port deprecated KCMultiDialog methods & embed json metadata in KCM
This KCM will have to get installed installed in the new plasma namespace eventually.
But considering that this app is part of the release service, we should not
depend on changes in a not yet released Plasma version.

Task: https://phabricator.kde.org/T14501
2021-12-15 08:24:22 +01:00
Nicolas Fella
c9bdf625c0 Set breeze as fallback icon theme for all executables 2021-07-27 23:03:51 +02:00
Piyush Aggarwal
296de907b5 indicator: fix single-click to open app and remove unnecessary capture 2021-07-12 05:35:25 +05:30
Piyush Aggarwal
e683dd218a indicator: add singleClick to open main app interface 2021-07-02 23:09:47 +05:30
Weixuan XIAO
6f342d3ec2 Fix exit due to too early D-Bus call on macOS
Move D-Bus call related code after daemonHook.
This should also keep compatibility on Windows.
2021-06-22 15:03:46 +02:00
Piyush Aggarwal
ad35ae75d9 indicator: move KDBusService::Unique call to make sure it works on Windows 2021-06-15 13:48:39 +05:30
Piyush Aggarwal
82c7a8080d add KColorSchemeManager instance to install auto dark theme on Windows 2021-06-13 13:51:28 +05:30
Piyush Aggarwal
360f540ffe indicator: add icon to quit option in systray menu 2021-06-12 05:22:54 +05:30
Piyush Aggarwal
13a99a7e99 Set program logo in KAboutData and trigger KIconLoader plugin in the process 2021-06-08 02:34:26 +05:30
Piyush Aggarwal
02ed0699ff set app style to breeze explicitly on Windows 2021-06-03 03:15:35 +05:30
Piyush Aggarwal
7b56c1d340 indicatorhelper: move terminateProcess calls to IndicatorHelper dtor 2021-05-29 00:12:26 +05:30
Piyush Aggarwal
e7c3c4fb7b indicator: open Configure menu on double click 2021-05-23 11:05:21 +05:30
Santhosh Anguluri
21db24c58c UseHighDpiPixmaps in kdeconnectd and kdeconnect-indicator 2021-01-29 20:34:51 +05:30
Piyush Aggarwal
06d81412b6 reliably kill dbus-daemon and kdeconnect-daemon using WinAPIs 2020-10-31 11:31:51 +00:00
Nicolas Fella
87db95b22f Convert license headers to SPDX expressions 2020-08-17 09:48:10 +00:00
Yuri Chornoivan
01c4d0411b Fix minor EBN issues 2019-12-22 09:49:55 +02:00
Nicolas Fella
41f5273574 Better macOS support in indicator
- Prolong waiting time on macOS
- Add a splash screen for macOS
- Separate platform-specified actions
2019-12-11 16:00:39 +01:00
Piyush Aggarwal
342e572d90 reliably close daemon and indicator when quitting on Windows and MacOS 2019-09-12 17:46:10 +00:00
Nicolas Fella
0d7c504cf0 Rename DbusHelper => DBusHelper 2019-08-14 17:36:19 +02:00
Weixuan Xiao
5fadeabce8 Optimization for executable path and resource path on macOS 2019-07-30 13:46:18 +00:00
Aleix Pol
c17972881b sms: Added opening kdeconnect-sms on the plasmoid and indicator
Add a menu entry on the kdeconnect-indicator within devices' submenu that opens kdeconnect-sms.
Also add it in the plasmoid in the device delegate.
2019-07-21 18:30:41 +02:00
Weixuan Xiao
5e827917a5 Close kdeconnectd from kdeconnect-cli with DBus 2019-07-20 09:17:03 +00:00
Piyush Aggarwal
875eba8e07 fix new indicator icon 2019-07-19 10:26:19 +00:00
Weixuan Xiao
df2ca7f25f Private DBus set launchctl env to fake a session bus 2019-07-09 19:42:08 +00:00
Piyush Aggarwal
ed5e9301c4 add quit option 2019-07-09 18:34:52 +00:00
Weixuan Xiao
6672e3eef5 Fix system tray icon on macOS 2019-06-18 20:51:13 +00:00
Weixuan Xiao
4f4b6c309f Allow to use private DBus 2019-06-18 01:21:31 +00:00
Nicolas Fella
e601755644 Force usage of QStringLiteral and port remaining offenders 2019-06-10 14:40:28 +00:00
Weixuan Xiao
86b82677a1 Allow kdeconnectd auto launch from kdeconnect-indicator on macOS 2019-06-09 21:36:42 +00:00
Weixuan Xiao
5431073844 Add wrapper for macos dbus connection 2019-06-09 15:28:49 +00:00
Albert Vaca Cintora
b776617646 Added new indicator icons for dark and clear backgrounds
Default to dark because it's more common (Windows, Gnome) but we need to
implement a way to chose automatically between the dark and clear icon
(and this is gonna be platform-specific).

Note that dashes in names have a special meaning when loading icons. The
new icon file names are ugly for this reason.
2019-06-08 13:07:01 +02:00
Nicolas Fella
3b8fedea1a Replace http GNU urls with https 2019-03-23 17:29:26 +01:00
Nicolas Fella
7e39c5df8f [indicator] Remove stray includes 2019-03-11 18:48:25 +01:00
Nicolas Fella
63a353550c Add icons to indicator
Reviewers: #kde_connect, albertvaka

Reviewed By: #kde_connect, albertvaka

Subscribers: kdeconnect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D17407
2018-12-07 17:32:03 +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
Aleix Pol
ecd4f81840 Don't block the process while showing the dialog
Otherwise it's not possible to interact with the system tray while the
dialog is open.
2017-05-25 00:16:05 +02:00
Aleix Pol
3e794dd4c7 Fix name 2017-05-24 23:25:18 +02:00
Albert Vaca
e3c4592577 Doesn't seem to like starting a process in the callback 2017-05-24 23:22:30 +02:00
Albert Vaca
9f95d8c4d3 Launch daemon with indicator on Windows
Since Dbus activation doesn't work on Windows
2017-05-24 22:57:36 +02:00
Albert Vaca
58f9045bfa Don't allow more than one indicator 2017-05-24 22:57:36 +02:00
Albert Astals Cid
f01f751708 Use a KCMultiDialog instead of calling kcmshell directly
Reviewed by Aleix
2017-05-24 19:59:04 +02:00
Aleix Pol
32002e3c46 Use KStatusNotifierItem on the indicator
Seems to work a bit better than QSystemTrayIcon
2017-03-27 20:44:36 +02:00
Albert Vaca
636a4507cc Actually, just set the tooltip to the icon
The tooltip within the menus behaved weird, and didn't add any info.
2017-02-28 22:08:40 +01:00
Albert Astals Cid
c2739f94f1 Do not create a new menu on every refreshMenu call
Seems to work better under Unity

Reviewed by Aleix Pol
2017-01-31 00:53:26 +01:00