8#ifndef SRC_CLIPBOARDMANAGER_H_
9#define SRC_CLIPBOARDMANAGER_H_
32static inline auto dwordBytes(quint32 value) -> QByteArray {
33 return {
reinterpret_cast<const char *
>(&value),
sizeof(value)};
74 void copyIfAlways(
const QString &text,
const QString &p_output = QString());
147 const QString &text);
auto trackedText() const -> QString
The text this manager last put on the clipboard and still tracks.
void trackCopied(const QString &text)
Track text that got onto the clipboard some other way.
QStringList m_otherCopies
trackCopied() texts, cleared with the rest
void makeRoomInOtherCopies()
Keep m_otherCopies below its cap before trackCopied() appends: drop the oldest text that is neither o...
void copyIfAlways(const QString &text, const QString &p_output=QString())
Handle clipboard copying for a shown entry.
void setAutoclearTimer()
Re-read the autoclear delay from the settings.
void forgetIfSaved(const QString &text)
Empty a saved previous text equal to text, now copied as a secret, so clear() does not put the secret...
void copyText(const QString &text)
Copy text into the system clipboard (or the X11 primary selection when configured) and arm the autocl...
QTimer m_clearTimer
Single-shot autoclear timer; started by copyText() when the autoclear setting is on,...
void clear()
Remove the tracked text from the clipboard if it is still there. Silent no-op when nothing is tracked...
std::optional< QString > m_previousSelection
As m_previousClipboard, for the X11 primary selection.
QString m_clippedText
The secret copyText() last put on the clipboard; clear() removes the clipboard content only while it ...
void statusMessage(const QString &message)
Something worth showing in the status bar happened.
ClipboardManager(QObject *parent=nullptr)
Construct a manager that also clears its text when the application quits.
std::optional< QString > m_previousClipboard
void saveWhatWasThere(QClipboard *clip, QClipboard::Mode mode, const QString &text)
Save what mode holds before the first secret of an autoclear window, for clear() to put back; saved a...
auto buildClipboardMimeData(const QString &text) -> QMimeData *
Build clipboard MIME data with platform-specific security hints.
static auto dwordBytes(quint32 value) -> QByteArray
Convert quint32 to byte array for Windows clipboard formats.