mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-12 14:47:16 +00:00
fix(chatinput/mentions) added clipboard proxy to prevent paste text missbehavior
This commit is contained in:
parent
18b87996eb
commit
1008ea78b0
39
vendor/DOtherSide/lib/include/DOtherSide/Status/QClipboardProxy.h
vendored
Normal file
39
vendor/DOtherSide/lib/include/DOtherSide/Status/QClipboardProxy.h
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
#ifndef QCLIPBOARDPROXY_HPP
|
||||
#define QCLIPBOARDPROXY_HPP
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QQmlEngine>
|
||||
#include <QJSEngine>
|
||||
|
||||
class QClipboard;
|
||||
|
||||
class QClipboardProxy : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(QClipboardProxy)
|
||||
Q_PROPERTY(QString text READ text NOTIFY textChanged)
|
||||
|
||||
QClipboardProxy() {}
|
||||
|
||||
public:
|
||||
explicit QClipboardProxy(QClipboard*);
|
||||
|
||||
QString text() const;
|
||||
|
||||
static QObject *qmlInstance(QQmlEngine *engine, QJSEngine *scriptEngine)
|
||||
{
|
||||
Q_UNUSED(engine);
|
||||
Q_UNUSED(scriptEngine);
|
||||
|
||||
return new QClipboardProxy;
|
||||
}
|
||||
|
||||
signals:
|
||||
void textChanged();
|
||||
|
||||
private:
|
||||
QClipboard* clipboard;
|
||||
};
|
||||
|
||||
#endif // QCLIPBOARDPROXY_HPP
|
5
vendor/DOtherSide/lib/src/DOtherSide.cpp
vendored
5
vendor/DOtherSide/lib/src/DOtherSide.cpp
vendored
@ -69,6 +69,7 @@
|
||||
#include "DOtherSide/Status/OSNotification.h"
|
||||
#include "DOtherSide/Status/KeychainManager.h"
|
||||
#include "DOtherSide/Status/SoundManager.h"
|
||||
#include "DOtherSide/Status/QClipboardProxy.h"
|
||||
#include "DOtherSide/DosSpellchecker.h"
|
||||
|
||||
namespace {
|
||||
@ -79,6 +80,8 @@ void register_meta_types()
|
||||
qmlRegisterType<StatusWindow>("DotherSide", 0 , 1, "StatusWindow");
|
||||
qmlRegisterType<StatusSyntaxHighlighterHelper>("DotherSide", 0 , 1, "StatusSyntaxHighlighter");
|
||||
qmlRegisterType<SpellChecker>("DotherSide", 0, 1, "SpellChecker");
|
||||
qmlRegisterSingletonType<QClipboardProxy>("DotherSide", 0 , 1, "QClipboardProxy", &QClipboardProxy::qmlInstance);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -1562,4 +1565,4 @@ void dos_app_make_it_active(::DosQQmlApplicationEngine* vptr)
|
||||
window->requestActivate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
13
vendor/DOtherSide/lib/src/Status/QClipboardProxy.cpp
vendored
Normal file
13
vendor/DOtherSide/lib/src/Status/QClipboardProxy.cpp
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
#include "DOtherSide/Status/QClipboardProxy.h"
|
||||
|
||||
#include <QClipboard>
|
||||
|
||||
QClipboardProxy::QClipboardProxy(QClipboard* c) : clipboard(c)
|
||||
{
|
||||
QObject::connect(c, SIGNAL (dataChanged()), this, SLOT(textChanged()));
|
||||
}
|
||||
|
||||
QString QClipboardProxy::text() const
|
||||
{
|
||||
return clipboard->text();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user