mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-07-25 15:55:38 -04:00
Change MacPasteboard init object to QScopedPointer
This commit is contained in:
parent
806248ebd4
commit
afe48da4b1
2 changed files with 4 additions and 15 deletions
|
@ -28,25 +28,15 @@ Clipboard* Clipboard::m_instance(nullptr);
|
||||||
Clipboard::Clipboard(QObject* parent)
|
Clipboard::Clipboard(QObject* parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, m_timer(new QTimer(this))
|
, m_timer(new QTimer(this))
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
, m_pasteboard(new MacPasteboard)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
m_timer->setSingleShot(true);
|
m_timer->setSingleShot(true);
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
m_pasteboard = new MacPasteboard;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
connect(m_timer, SIGNAL(timeout()), SLOT(clearClipboard()));
|
connect(m_timer, SIGNAL(timeout()), SLOT(clearClipboard()));
|
||||||
connect(qApp, SIGNAL(aboutToQuit()), SLOT(clearCopiedText()));
|
connect(qApp, SIGNAL(aboutToQuit()), SLOT(clearCopiedText()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Clipboard::~Clipboard()
|
|
||||||
{
|
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
if (m_pasteboard) {
|
|
||||||
delete m_pasteboard;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void Clipboard::setText(const QString& text)
|
void Clipboard::setText(const QString& text)
|
||||||
{
|
{
|
||||||
QClipboard* clipboard = QApplication::clipboard();
|
QClipboard* clipboard = QApplication::clipboard();
|
||||||
|
|
|
@ -31,7 +31,6 @@ class Clipboard : public QObject
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void setText(const QString& text);
|
void setText(const QString& text);
|
||||||
~Clipboard();
|
|
||||||
|
|
||||||
static Clipboard* instance();
|
static Clipboard* instance();
|
||||||
|
|
||||||
|
@ -48,7 +47,7 @@ private:
|
||||||
|
|
||||||
QTimer* m_timer;
|
QTimer* m_timer;
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
MacPasteboard* m_pasteboard;
|
QScopedPointer<MacPasteboard> m_pasteboard;
|
||||||
#endif
|
#endif
|
||||||
QString m_lastCopied;
|
QString m_lastCopied;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue