Commit graph

19 commits

Author SHA1 Message Date
Alexander Lohnau
1631ada5b3 Simplify KDEConnectPlugin::recievePacket
- We do not need the return type. If a plugin declares it can handle the
  packet it should do so. We don't have any fallback logic in place and
  the packet types are namespaced with the plugin IDs anyway.

- Provide a default implementation with a warning, not all plugins need
  to overwrite this
2023-08-03 20:49:44 +02:00
Alexander Lohnau
75a8db1ec5 Use pragma once in plugins
For non-library code, this is simpler and more concise
2023-07-22 20:51:19 +00:00
Albert Vaca Cintora
144a60b58a Allow disabling clipboard auto-share and add option to share manually
Continues the work started in !396 by rebasing it onto latest master and
making the "send clipboard" button from the plasmoid invisible when
automatic syncing is enabled.
    
I didn't find a way to do the same in kdeconnect-indicator and
kdeconnect-app (why do we have 3 UIs???), so in those we always show the
option for now.
2023-06-07 19:48:25 +00:00
Yuchen Shi
b9a089344e Add config for clipboard plugin on content types to share.
## Summary

This MR adds a config dialog for the Clipboard plugin, where the user can toggle
whether to share password and/or anything else with other devices.

Implements !39

BUG: 458063

According to previous discussion at !39 (and the bug linked), some users want to
skip sending passwords to other devices while others rely on the existing behavior.
This MR addresses that by allowing users to control those two types separately and
will replace !39 if merged.

![Screenshot with new config dialog](/uploads/3dfc6c6d69b86e6512e6a8948320a839/Screenshot_1661407807.png)

Borrowing the idea from !39, the `x-kde-passwordManagerHint` MIME data hint is used
to determine whether the content is considered secret. I've tested this method with
KeepassXC which [sets this correctly](a6d3f973fa/src/gui/Clipboard.cpp (L62)). See test plan below.

In theory, MIME also can be used to test for images and another checkbox can
be easily added should we decided to support images later. For now though, the
enum and the config supports only passwords or "anything else". Both defaults to true,
thus keeping full backwards compatibility. I've been keeping both unchecked since
I only share in one direction (Android to Linux), which wasn't possible until this MR.
Others may want to make their own choices.

## Test Plan

Please reference the screenshot above for the steps.

From the indicator, right-click and select `Configure`. Select a device from the
left side (or pair one if needed). In "available plugins", make sure "Clipboard"
is checked, and verify that a "Configure" icon button is now shown on the right.

Clicking that icon should bring up the new config dialog, where the two check boxes
can be toggled as desired. Click on "OK" to save and apply the settings. Clicking on
"Defaults" should bring both back to checked (the default behavior).

Copy normal plain text from your favorite text editor and it should be sent to another
device if the "anything else" checkbox is checked. I've tested this on an Android phone
but I see no reason it won't work elsewhere given the code for sending has not been changed.
(Feel free to test on other devices.)

Open KeepassXC and select an entry, right click and select "Copy password". This sets
the MIME hint so it should be treated as a password, controlled by the "passwords" checkbox.
I've toggled the settings multiple times on and off. Once "OK" is clicked, the next clipboard
change should pick up the latest settings.

I've only tested on Linux desktops (Arch Linux) since I do not own a Mac. I don't believe any
OS X application sets `x-kde-passwordManagerHint` at all, so they may be controlled by "anything else".
2022-10-17 21:04:20 +00:00
Nicolas Fella
a918ffc0cb Add and make use of ECM's clang-format integration 2022-09-11 23:21:58 +00:00
Nicolas Fella
87db95b22f Convert license headers to SPDX expressions 2020-08-17 09:48:10 +00: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
Colin Redman
7799973371 Clipboard sync on new connection
Summary: Added a timestamp to track clipboard changes, so when a new device connects it will sync the most recently updated clipboard to both devices.

Reviewers: #kde_connect, albertvaka

Reviewed By: #kde_connect, albertvaka

Subscribers: albertvaka, sredman, kdeconnect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D22584
2019-07-23 16:22:02 +02:00
Nicolas Fella
3b8fedea1a Replace http GNU urls with https 2019-03-23 17:29:26 +01: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
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
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
Albert Vaca
60331ccbf1 Clazy says all this QStringLiteral and QLatin1String were missing/wrong 2016-11-26 16:21:29 +01:00
Albert Vaca
c19f26a95d Fixed clipboard propagation loop bug
BUG: 362596
2016-09-09 16:18:56 +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
Aleix Pol
d58f6314fe run Clang Modernize
Minus the auto change
2015-09-08 10:47:37 +02:00
Albert Vaca
0eeb58356c Fixed clipboard re-setting infinitely when devices form a connection loop.
Not tested.

BUG: 346173
2015-04-19 12:32:26 -07:00
Àlex Fiestas
2b0eecc599 Port clipboard away from kDebug 2014-09-22 00:44:32 +02:00
Aleix Pol
741abafaf7 Move the plugins into a different top-ĺevel directory
Reviewed by Albert Vaca
2014-06-14 16:34:11 +02:00
Renamed from core/plugins/clipboard/clipboardplugin.h (Browse further)