D6730: Determine which IP address to use for sshfs

Albert Vaca Cintora noreply at phabricator.kde.org
Fri Jul 21 09:20:37 UTC 2017


albertvaka requested changes to this revision.
albertvaka added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> devicelink.h:74
>      QCA::PrivateKey mPrivateKey;
> +    QHostAddress mHostAddress;
>  

I don't think is necessary to move this to the DeviceLink class: you can do a qobject_cast or dynamic_cast to LanDeviceLink on all the DeviceLinks of a Device until you find the one that is actually a LanDeviceLink (which, since we only have one type of link as of now, will always be the case), and then get the IP from that one.

> device.cpp:383
>  
> +DeviceLink* Device::deviceLink(const QString& id) const
> +{

The id parameter is redundant: All the device links for this device are gonna match the id.

> mounter.cpp:117
> +    QString deviceId = m_sftp->device()->id();
> +    DeviceLink* dl = m_sftp->device()->deviceLink(deviceId);
> +    QString ip = dl->hostAddress().toString();

Maybe you can add a function to device that returns the IP directly?

m_sftp->device()->getLocalIpAddress()

That function would be responsible of finding a LanDeviceLink for the device, and if it found one get the IP from it.

If the device doesn't have a LanDeviceLink, this function could return an empty QHostAddress object, so the plugin prints an error and doesn't try to connect.

REPOSITORY
  R224 KDE Connect

REVISION DETAIL
  https://phabricator.kde.org/D6730

To: jeanv, #kde_connect, albertvaka
Cc: albertvaka, apol, nicolasfella, sredman, tfella, aboudhar, seebauer, progwolff, MayeulC, menasshock, ach, hkaelberer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdeconnect/attachments/20170721/ecc4fba2/attachment.html>


More information about the KDEConnect mailing list