D16279: Show progress when sending a file from desktop

Aleix Pol Gonzalez noreply at phabricator.kde.org
Sun Oct 28 23:47:58 GMT 2018


apol added inline comments.

INLINE COMMENTS

> uploadjob.cpp:42
> +    
> +    m_uploadTimoutTimer.setInterval(5000);
> +    connect(&m_uploadTimoutTimer, &QTimer::timeout, this, &UploadJob::uploadTimeout);

If this is a workaround, explain it here for the day when someone has the idea to remove it.

> uploadjob.cpp:62
> +   
> +    description(this, i18n("Sending file to %1", Daemon::instance()->getDevice(this->m_deviceId)->name()), 
> +                { i18nc("File transfer origin", "From"), m_input.staticCast<QFile>().data()->fileName() }

Use `emit description(...`. It helps when reading the code, to see it's actually a signal.

> uploadjob.cpp:98
> +    
> +    if (!m_timer.isValid()) {
> +        m_timer.start();

Why are you checking for validity? Are you trying to do isActive?
Actually, It seems like it should always be called there.

> uploadjob.cpp:120
> +        m_input->close();
> +        disconnect(m_socket, &QSslSocket::encryptedBytesWritten, this, &UploadJob::encryptedBytesWritten);
> +    }

Is it really necessary to disconnect? the socket shouldn't be working anymore.

> uploadjob.cpp:129
> +    
> +qCDebug(KDECONNECT_CORE) << "encryptedBytesWritten: " << bytes << "encryptedBytesToWrite: " << m_socket->encryptedBytesToWrite();    
> +    bytesUploaded += bytesUploading;

Wrong indentation.

> uploadjob.cpp:193
> +    setError(2);
> +    emitResult();
> +    disconnect(m_socket, &QSslSocket::encryptedBytesWritten, this, &UploadJob::encryptedBytesWritten);

Emit after everything is wrapped up. Otherwise things could happen right there.

REPOSITORY
  R224 KDE Connect

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

To: eduisters, #kde_connect, nicolasfella
Cc: apol, broulik, nicolasfella, kdeconnect, skymoore, wistak, dvalencia, rmenezes, julioc, Leptopoda, timothyc, jdvr, yannux, Danial0_0, johnq, Pitel, adeen-s, SemperPeritus, daniel.z.tg, jeanv, seebauer, bugzy, MayeulC, menasshock, tctara
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdeconnect/attachments/20181028/88ba3881/attachment-0001.html>


More information about the KDEConnect mailing list