Bug 444472

Summary: One-way clipboard sharing no longer works
Product: [Applications] kdeconnect Reporter: Roy Orbitson <roy-orbitson>
Component: android-applicationAssignee: Albert Vaca Cintora <albertvaka>
Status: REPORTED ---    
Severity: normal CC: fabian
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Android   
OS: Android 11.x   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Roy Orbitson 2021-10-27 06:44:27 UTC
SUMMARY
With the clipboard sharing plugin enabled on my (work) desktop, but disabled on my (personal & work) phone, I used to be able to copy text on my desktop and paste it on my phone, but keep my phone's clipboard private. Now nothing is copied to my phone.

STEPS TO REPRODUCE
1. Disable clipboard plugin in Android app
2. Enable clipboard plugin in KDEConnect desktop settings
3. Copy some text on desktop

OBSERVED RESULT
Android clipboard content is unchanged

EXPECTED RESULT
Android clipboard should contain the copied text

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
KDE Plasma Version: 5.22.5
KDE Frameworks Version: 5.86.0
Qt Version: 5.15.2
Comment 1 fabian 2023-01-27 22:09:51 UTC
It does not work the other way around too. I'm not entirely sure, but I think it was possible to send clipboard content from android to linux even if the clipboard plugin was disabled in linux. Now it only works if the feature is enabled on both devices. Currently this is annoying because linux automatically sends it's clipboard content to android and android has a new popup when receiving clipboard content with Android 13.
Comment 2 fabian 2023-02-12 10:47:07 UTC
I've quickly looked through the code. For the other way around, the fix is probably to disable the automatic sending of clipboard content to your phone. See the fix below. It would probably be best if a user could toggle that functionality. (These android 13 clipboard popups are annoying)

For a quick and dirty fix just comment the lines in ClipboardListener::ClipboardListener() in the file kdeconnect-kde/plugins/clipboard/clipboardlistener.cpp:

ClipboardListener::ClipboardListener()
    : clipboard(KSystemClipboard::instance())
{
// #ifdef Q_OS_MAC
//     connect(&m_clipboardMonitorTimer, &QTimer::timeout, this, [this]() {
//         updateClipboard(QClipboard::Clipboard);
//     });
//     m_clipboardMonitorTimer.start(1000); // Refresh 1s
// #endif
//     connect(clipboard, &KSystemClipboard::changed, this, &ClipboardListener::updateClipboard);
}