mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-29 01:06:27 -05:00
Review fixes
This commit is contained in:
parent
dc7322cc4a
commit
806248ebd4
@ -26,12 +26,12 @@ class MacPasteboard : public QMacPasteboardMime
|
|||||||
public:
|
public:
|
||||||
explicit MacPasteboard() : QMacPasteboardMime(MIME_ALL) {}
|
explicit MacPasteboard() : QMacPasteboardMime(MIME_ALL) {}
|
||||||
|
|
||||||
QString convertorName();
|
QString convertorName() override;
|
||||||
bool canConvert(const QString &mime, QString flav);
|
bool canConvert(const QString &mime, QString flav) override;
|
||||||
QString mimeFor(QString flav);
|
QString mimeFor(QString flav) override;
|
||||||
QString flavorFor(const QString &mime);
|
QString flavorFor(const QString &mime) override;
|
||||||
QVariant convertToMime(const QString &mime, QList<QByteArray> data, QString flav);
|
QVariant convertToMime(const QString &mime, QList<QByteArray> data, QString flav) override;
|
||||||
QList<QByteArray> convertFromMime(const QString &mime, QVariant data, QString flav);
|
QList<QByteArray> convertFromMime(const QString &mime, QVariant data, QString flav) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // KEEPASSXC_MACPASTEBOARD_H
|
#endif // KEEPASSXC_MACPASTEBOARD_H
|
||||||
|
@ -22,9 +22,6 @@
|
|||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
#include "core/Config.h"
|
#include "core/Config.h"
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
#include "core/MacPasteboard.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Clipboard* Clipboard::m_instance(nullptr);
|
Clipboard* Clipboard::m_instance(nullptr);
|
||||||
|
|
||||||
@ -33,16 +30,28 @@ Clipboard::Clipboard(QObject* parent)
|
|||||||
, m_timer(new QTimer(this))
|
, m_timer(new QTimer(this))
|
||||||
{
|
{
|
||||||
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();
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
new MacPasteboard;
|
|
||||||
QMimeData* mime = new QMimeData;
|
QMimeData* mime = new QMimeData;
|
||||||
mime->setText(text);
|
mime->setText(text);
|
||||||
mime->setData("application/x-nspasteboard-concealed-type", text.toUtf8());
|
mime->setData("application/x-nspasteboard-concealed-type", text.toUtf8());
|
||||||
|
@ -19,6 +19,9 @@
|
|||||||
#define KEEPASSX_CLIPBOARD_H
|
#define KEEPASSX_CLIPBOARD_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
#include "core/MacPasteboard.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class QTimer;
|
class QTimer;
|
||||||
|
|
||||||
@ -28,6 +31,7 @@ class Clipboard : public QObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
void setText(const QString& text);
|
void setText(const QString& text);
|
||||||
|
~Clipboard();
|
||||||
|
|
||||||
static Clipboard* instance();
|
static Clipboard* instance();
|
||||||
|
|
||||||
@ -43,6 +47,9 @@ private:
|
|||||||
static Clipboard* m_instance;
|
static Clipboard* m_instance;
|
||||||
|
|
||||||
QTimer* m_timer;
|
QTimer* m_timer;
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
MacPasteboard* m_pasteboard;
|
||||||
|
#endif
|
||||||
QString m_lastCopied;
|
QString m_lastCopied;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user