Add SyncthingConnection::isLocal()

This commit is contained in:
Martchus 2017-09-08 16:47:44 +02:00
parent 7a1dda6235
commit 6585117186
2 changed files with 8 additions and 1 deletions

View File

@ -100,6 +100,11 @@ SyncthingConnection::~SyncthingConnection()
disconnect();
}
bool SyncthingConnection::isLocal() const
{
return ::Data::isLocal(QUrl(m_syncthingUrl));
}
/*!
* \brief Returns the string representation of the current status().
*/
@ -819,7 +824,7 @@ bool SyncthingConnection::loadSelfSignedCertificate()
}
// only possible if the Syncthing instance is running on the local machine
if (!isLocal(syncthingUrl)) {
if (!::Data::isLocal(syncthingUrl)) {
return false;
}

View File

@ -63,6 +63,7 @@ class LIB_SYNCTHING_CONNECTOR_EXPORT SyncthingConnection : public QObject {
Q_OBJECT
Q_PROPERTY(QString syncthingUrl READ syncthingUrl WRITE setSyncthingUrl)
Q_PROPERTY(QByteArray apiKey READ apiKey WRITE setApiKey)
Q_PROPERTY(bool isLocal READ isLocal)
Q_PROPERTY(Data::SyncthingStatus status READ status NOTIFY statusChanged)
Q_PROPERTY(QString statusText READ statusText NOTIFY statusChanged)
Q_PROPERTY(bool connected READ isConnected NOTIFY statusChanged)
@ -84,6 +85,7 @@ public:
const QString &syncthingUrl() const;
void setSyncthingUrl(const QString &url);
bool isLocal() const;
const QByteArray &apiKey() const;
void setApiKey(const QByteArray &apiKey);
const QString &user() const;