Minor changes

This commit is contained in:
Albert Vaca 2014-08-11 18:53:08 +02:00
parent 871a2bf5a9
commit a3b89da9c7
3 changed files with 9 additions and 8 deletions

View file

@ -98,6 +98,8 @@ void LanLinkProvider::onNetworkChange(QNetworkSession::State state)
NetworkPackage::createIdentityPackage(&np);
np.set("tcpPort", mTcpPort);
mUdpSocket.writeDatagram(np.serialize(), QHostAddress("255.255.255.255"), port);
//TODO: Ping active connections to see if they are still reachable
}
//I'm the existing device, a new device is kindly introducing itself (I will create a TcpSocket)
@ -127,13 +129,13 @@ void LanLinkProvider::newUdpConnection()
NetworkPackage::createIdentityPackage(&np2);
if (receivedPackage->get<QString>("deviceId") == np2.get<QString>("deviceId")) {
//kDebug(kdeconnect_kded()) << "Ignoring my own broadcast";
//kDebug(debugArea()) << "Ignoring my own broadcast";
return;
}
int tcpPort = receivedPackage->get<int>("tcpPort", port);
//kDebug(kdeconnect_kded()) << "Received Udp presentation from" << sender << "asking for a tcp connection on port " << tcpPort;
//kDebug(debugArea()) << "Received Udp presentation from" << sender << "asking for a tcp connection on port " << tcpPort;
QTcpSocket* socket = new QTcpSocket(this);
receivedIdentityPackages[socket].np = receivedPackage;

View file

@ -61,6 +61,8 @@ Daemon::Daemon(QObject *parent)
: QObject(parent)
, d(new DaemonPrivate)
{
kDebug(debugArea()) << "KdeConnect daemon starting";
KSharedConfigPtr config = KSharedConfig::openConfig("kdeconnectrc");
if (!config->group("myself").hasKey("id")) {
@ -76,7 +78,7 @@ Daemon::Daemon(QObject *parent)
if(!QCA::isSupported("rsa")) {
//TODO: Maybe display this in a more visible way?
kWarning(debugArea()) << "Error: KDE Connect could not find support for RSA in your QCA installation, if your distribution provides"
<< "separate packages for QCA-ossl and QCA-gnupg plugins, make sure you have them installed and try again";
<< "separate packages for QCA-ossl and QCA-gnupg plugins, make sure you have them installed and try again.";
return;
}
@ -110,14 +112,11 @@ Daemon::Daemon(QObject *parent)
config->group("myself").writeEntry("privateKeyPath", privateKeyPath);
config->sync();
}
if (QFile::permissions(config->group("myself").readEntry("privateKeyPath")) != strict)
{
kWarning(debugArea()) << "Error: KDE Connect detects wrong permissions for private file " << config->group("myself").readEntry("privateKeyPath");
}
//Debugging
kDebug(debugArea()) << "Starting KdeConnect daemon";
//Load backends (hardcoded by now, should be plugins in a future)
d->mLinkProviders.insert(new LanLinkProvider());
@ -148,11 +147,11 @@ Daemon::Daemon(QObject *parent)
setDiscoveryEnabled(true);
kDebug(debugArea()) << "KdeConnect daemon started";
}
void Daemon::setDiscoveryEnabled(bool b)
{
//Listen to incomming connections
Q_FOREACH (LinkProvider* a, d->mLinkProviders) {
if (b)
a->onStart();

View file

@ -33,7 +33,7 @@ public:
virtual bool lessThan(const QModelIndex& left, const QModelIndex& right) const;
virtual bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const;
public slots:
public Q_SLOTS:
void sourceDataChanged(QModelIndex,QModelIndex);
};