Clipboard-history host for Phosphor-based desktop shells. More...
#include <PhosphorServiceClipboard/ClipboardService.h>
Signals | |
| void | countChanged () |
Public Member Functions | |
| ClipboardService (QObject *parent=nullptr) | |
| ~ClipboardService () override | |
| bool | isSupported () const |
| Whether the compositor advertises the wlr-data-control protocol this service builds on. | |
| QAbstractItemModel * | history () const |
| The history list model (most-recent first). Owned by the service. | |
| int | count () const |
| Number of entries in the history. | |
| bool | copy (int index) |
Re-apply the entry at index to the clipboard selection. | |
| bool | remove (int index) |
Remove the entry at index from the history (and disk). | |
| void | clear () |
| Clear the entire history (and disk). | |
Clipboard-history host for Phosphor-based desktop shells.
Watches the session clipboard through phosphor-wayland's ClipboardDevice (a wlr-data-control client), keeps a de-duplicated, capped, on-disk history, and can re-apply any entry. It is the policy / history / persistence layer over the raw device; it composes the device rather than binding the protocol itself, so its public surface is a clean Qt/QML type with no Wayland types leaking out.
The history loads from disk on construction and persists on every change. A dialog binds history (a model with preview / mimeType / offeredTypes / timestamp roles, most-recent first) and calls copy(index) to paste an entry back. Sensitive selections (password-manager hints) are never read or kept.
|
explicit |
|
override |
| void PhosphorServiceClipboard::ClipboardService::clear | ( | ) |
Clear the entire history (and disk).
| bool PhosphorServiceClipboard::ClipboardService::copy | ( | int | index | ) |
Re-apply the entry at index to the clipboard selection.
Returns false when the index is out of range or the entry carries no content or mime type, so a caller can tell a real copy from a silently ignored one. The launcher needs that distinction: it keeps its surface open on a refused activation rather than closing on a no-op.
|
nodiscard |
Number of entries in the history.
|
signal |
|
nodiscard |
The history list model (most-recent first). Owned by the service.
|
nodiscard |
Whether the compositor advertises the wlr-data-control protocol this service builds on.
When false the service constructs but stays inert (the persisted history still loads and is readable).
| bool PhosphorServiceClipboard::ClipboardService::remove | ( | int | index | ) |
Remove the entry at index from the history (and disk).
Returns false when the index is out of range.