QtDataSync  4.2.0
A simple offline-first synchronisation framework, to synchronize data of Qt applications between devices
Signals | Public Member Functions | Properties | List of all members
de::skycoder42::QtDataSync::UserExchangeManager Class Reference

The QML binding of QtDataSync::UserExchangeManager. More...

#include <qqmluserexchangemanager.h>

+ Inheritance diagram for de::skycoder42::QtDataSync::UserExchangeManager:

Signals

void setupNameChanged (QString setupName)
 NOTIFY accessor for AccountManager::setupName.
 
void managerChanged (QQmlAccountManager *manager)
 NOTIFY accessor for AccountManager::manager.
 
void validChanged (bool valid)
 NOTIFY accessor for AccountManager::valid.
 
- Signals inherited from QtDataSync::UserExchangeManager
void userDataReceived (const QtDataSync::UserInfo &userInfo, bool trusted, QPrivateSignal)
 Is emitted, when a user identity was received from the given user. More...
 
void exchangeError (const QString &errorString, QPrivateSignal)
 Is emitted when an error occured trying to export or import. More...
 
QT_DATASYNC_REVISION_2 void setupNameChanged (const QString &setupName, QPrivateSignal)
 NOTIFY accessor for UserInfo::setupName.
 
void activeChanged (bool active, QPrivateSignal)
 NOTIFY accessor for UserInfo::active.
 
void devicesChanged (QList< QtDataSync::UserInfo > devices, QPrivateSignal)
 NOTIFY accessor for UserInfo::users.
 

Public Member Functions

Q_INVOKABLE void importFrom (const QtDataSync::UserInfo &userInfo, const QJSValue &completedFn, bool keepData=false)
 Imports the untrusted user data previously received by the given user. More...
 
Q_INVOKABLE void importTrustedFrom (const QtDataSync::UserInfo &userInfo, const QString &password, const QJSValue &completedFn, bool keepData=false)
 Imports the trusted user data previously received by the given user. More...
 
- Public Member Functions inherited from QtDataSync::UserExchangeManager
 UserExchangeManager (QObject *parent=nullptr)
 Default constructor, uses the default setup. More...
 
 UserExchangeManager (const QString &setupName, QObject *parent=nullptr)
 Constructor with an explicit setup. More...
 
 UserExchangeManager (AccountManager *manager, QObject *parent=nullptr)
 Constructor with an account manager to use for account import and export. More...
 
AccountManageraccountManager () const
 The internally used account manager used to export and import data. More...
 
QString setupName () const
 NOTIFY accessor for UserInfo::setupName.
 
quint16 port () const
 Returns the currently used port. More...
 
bool isActive () const
 READ accessor for UserInfo::active.
 
QList< UserInfodevices () const
 READ accessor for UserInfo::users.
 
Q_INVOKABLE void exportTo (const QtDataSync::UserInfo &userInfo, bool includeServer)
 Sends the user identity to the given user as untrusted export. More...
 
Q_INVOKABLE void exportTrustedTo (const QtDataSync::UserInfo &userInfo, bool includeServer, const QString &password)
 Sends the user identity to the given user as trusted export. More...
 
void importFrom (const QtDataSync::UserInfo &userInfo, const std::function< void(bool, QString)> &completedFn, bool keepData=false)
 Imports the untrusted user data previously received by the given user. More...
 
void importTrustedFrom (const QtDataSync::UserInfo &userInfo, const QString &password, const std::function< void(bool, QString)> &completedFn, bool keepData=false)
 Imports the trusted user data previously received by the given user. More...
 
- Public Member Functions inherited from QObject
virtual const QMetaObjectmetaObject () const const
 
virtual void * qt_metacast (const char *)
 
virtual int qt_metacall (QMetaObject::Call, int, void **)
 
 QObject (QObject *parent)
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
QString objectName () const const
 
void setObjectName (const QString &name)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
bool signalsBlocked () const const
 
bool blockSignals (bool block)
 
QThreadthread () const const
 
void moveToThread (QThread *targetThread)
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
void killTimer (int id)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
const QObjectList & children () const const
 
void setParent (QObject *parent)
 
void installEventFilter (QObject *filterObj)
 
void removeEventFilter (QObject *obj)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectTree ()
 
void dumpObjectInfo ()
 
void dumpObjectTree () const const
 
void dumpObjectInfo () const const
 
bool setProperty (const char *name, const QVariant &value)
 
QVariant property (const char *name) const const
 
QList< QByteArraydynamicPropertyNames () const const
 
void destroyed (QObject *obj)
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
bool inherits (const char *className) const const
 
void deleteLater ()
 

Properties

quint16 DataExchangePort
 The default port (13742) for the data exchange. More...
 
QString setupName
 Holds the name of the setup this manager operates on. More...
 
QQmlAccountManager manager
 Holds the data store this model operates on. More...
 
bool valid
 Specifies if the object was correctly initialized. More...
 
- Properties inherited from QtDataSync::UserExchangeManager
QString setupName
 Holds the name of the setup this manager operates on. More...
 
bool active
 Reports whether the instance is currently exchanging or not. More...
 
QList< QtDataSync::UserInfodevices
 Holds all currently discovered devices. More...
 
- Properties inherited from QObject
 objectName
 

Additional Inherited Members

- Public Slots inherited from QtDataSync::UserExchangeManager
bool startExchange (quint16 port=DataExchangePort)
 Start the exchange discovery on the specified port. More...
 
bool startExchange (const QHostAddress &listenAddress, quint16 port=DataExchangePort)
 Start the exchange discovery on the specified address and port. More...
 
void stopExchange ()
 Stops the exchange discovery. More...
 
- Static Public Member Functions inherited from QObject
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
- Static Public Attributes inherited from QtDataSync::UserExchangeManager
static const quint16 DataExchangePort
 The default port (13742) for the data exchange.
 
- Protected Member Functions inherited from QObject
QObjectsender () const const
 
int senderSignalIndex () const const
 
int receivers (const char *signal) const const
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
virtual void timerEvent (QTimerEvent *event)
 
virtual void childEvent (QChildEvent *event)
 
virtual void customEvent (QEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 

Detailed Description

The QML binding of QtDataSync::UserExchangeManager.

Since
4.0
See also
QtDataSync::UserExchangeManager

Definition at line 21 of file qqmluserexchangemanager.h.

Member Function Documentation

◆ importFrom()

Q_INVOKABLE void de::skycoder42::QtDataSync::UserExchangeManager::importFrom ( const QtDataSync::UserInfo userInfo,
const QJSValue completedFn,
bool  keepData = false 
)

Imports the untrusted user data previously received by the given user.

Parameters
userInfoThe user to that sent the data to import
completedFnA function that is called once the import has been finished
keepDataSpecify whether the stored data should be preserved

Use this method to perform the actual import of an identity after receiving it via userDataReceived(). This only works if data has been received from the user that way. Otherwise the operation will fail.

Internally, AccountManager::importAccount is used to perform the actual import. The received data is simply passed to that method. See that documentation for more details.

See also
UserExchangeManager::userDataReceived, UserExchangeManager::exportTo, UserExchangeManager::importTrustedFrom, AccountManager::importAccount

◆ importTrustedFrom()

Q_INVOKABLE void de::skycoder42::QtDataSync::UserExchangeManager::importTrustedFrom ( const QtDataSync::UserInfo userInfo,
const QString password,
const QJSValue completedFn,
bool  keepData = false 
)

Imports the trusted user data previously received by the given user.

Parameters
userInfoThe user to that sent the data to import
passwordThe password used to decrypt the imported data with. Must be the same as used for the export
completedFnA function that is called once the import has been finished
keepDataSpecify whether the stored data should be preserved

Use this method to perform the actual import of an identity after receiving it via userDataReceived(). This only works if data has been received from the user that way. Otherwise the operation will fail.

Internally, AccountManager::importAccountTrusted is used to perform the actual import. The received data is simply passed to that method. See that documentation for more details.

See also
UserExchangeManager::userDataReceived, UserExchangeManager::exportTrustedTo, UserExchangeManager::importFrom, AccountManager::importAccountTrusted

Property Documentation

◆ DataExchangePort

quint16 de::skycoder42::QtDataSync::UserExchangeManager::DataExchangePort
read

The default port (13742) for the data exchange.

Default: 13742

Accessors
MEMBERDataExchangePort
READ ONLY
See also
QtDataSync::UserExchangeManager::DataExchangePort

Definition at line 43 of file qqmluserexchangemanager.h.

◆ manager

QQmlAccountManager de::skycoder42::QtDataSync::UserExchangeManager::manager
readwrite

Holds the data store this model operates on.

Default: nullptr

Allows you to specify a datastore instead of a setup to initialize the model

Warning
This property must only ever be set on construction of the object and must not be changed afterwards. Do not set both, this property and setupName
Accessors
MEMBERsetupName
NOTIFYsetupNameChanged()
See also
UserExchangeManager::setupName, UserExchangeManager::valid

Definition at line 78 of file qqmluserexchangemanager.h.

◆ setupName

QString de::skycoder42::QtDataSync::UserExchangeManager::setupName
readwrite

Holds the name of the setup this manager operates on.

Default: QtDataSync::DefaultSetup

Allows you to specify the name of the setup that this manager should use

Warning
This property must only ever be set on construction of the object and must not be changed afterwards. Do not set both, this property and manager
Accessors
MEMBERsetupName
NOTIFYsetupNameChanged()
See also
QtDataSync::UserExchangeManager::setupName, UserExchangeManager::manager, UserExchangeManager::valid

Definition at line 61 of file qqmluserexchangemanager.h.

◆ valid

bool de::skycoder42::QtDataSync::UserExchangeManager::valid
read

Specifies if the object was correctly initialized.

Default: false

Only becomes true if the given setup name resolves to a valid datasync instance or if the given manager is valid

Accessors
MEMBERvalid
NOTIFYvalidChanged()
READ ONLY
See also
UserExchangeManager::setupName, UserExchangeManager::manager

Definition at line 94 of file qqmluserexchangemanager.h.


The documentation for this class was generated from the following file: