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