Changeset View
Changeset View
Standalone View
Standalone View
plugins/clipboard/clipboardlistener.cpp
Show All 32 Lines | |||||
33 | void ClipboardListener::updateClipboard(QClipboard::Mode mode) | 33 | void ClipboardListener::updateClipboard(QClipboard::Mode mode) | ||
34 | { | 34 | { | ||
35 | if (mode != QClipboard::Clipboard) { | 35 | if (mode != QClipboard::Clipboard) { | ||
36 | return; | 36 | return; | ||
37 | } | 37 | } | ||
38 | 38 | | |||
39 | QString content = clipboard->text(); | 39 | QString content = clipboard->text(); | ||
40 | 40 | | |||
41 | if (content == currentContent) { | 41 | if (content == m_currentContent) { | ||
42 | return; | 42 | return; | ||
43 | } | 43 | } | ||
44 | currentContent = content; | 44 | m_updateTimestamp = QDateTime::currentDateTime().toMSecsSinceEpoch(); | ||
45 | m_currentContent = content; | ||||
45 | 46 | | |||
46 | Q_EMIT clipboardChanged(content); | 47 | Q_EMIT clipboardChanged(content); | ||
47 | } | 48 | } | ||
48 | 49 | | |||
50 | QString ClipboardListener::currentContent() | ||||
51 | { | ||||
52 | return m_currentContent; | ||||
53 | } | ||||
54 | | ||||
55 | qint64 ClipboardListener::updateTimestamp(){ | ||||
56 | | ||||
57 | return m_updateTimestamp; | ||||
58 | } | ||||
59 | | ||||
49 | void ClipboardListener::setText(const QString& content) | 60 | void ClipboardListener::setText(const QString& content) | ||
50 | { | 61 | { | ||
51 | currentContent = content; | 62 | m_updateTimestamp = QDateTime::currentDateTime().toMSecsSinceEpoch(); | ||
63 | m_currentContent = content; | ||||
52 | clipboard->setText(content); | 64 | clipboard->setText(content); | ||
53 | } | 65 | } |