Show progress when sending a file from desktop
ClosedPublic

Authored by eduisters on Oct 17 2018, 5:24 PM.

Details

Summary

Show progress when sending a file from the desktop

BUG: 355044

Test Plan

Complete transfer:
-Right click on a big file in dolphin
-Select Send to xx via KDE Connect
-Open the Notifications widget and verify progress is shown correctly

Stop transfer:
-Right click on a big file in dolphin
-Select Send to xx via KDE Connect
-Open The Notifications widget and press the stop/kill button
-Observe that the file upload is stopped

Diff Detail

Repository
R224 KDE Connect
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
eduisters created this revision.Oct 17 2018, 5:24 PM
Restricted Application added a project: KDE Connect. · View Herald TranscriptOct 17 2018, 5:24 PM
Restricted Application added a subscriber: kdeconnect. · View Herald Transcript
eduisters requested review of this revision.Oct 17 2018, 5:24 PM
nicolasfella requested changes to this revision.Oct 17 2018, 7:33 PM
nicolasfella added a subscriber: nicolasfella.

Great work!

I have a few cosmetic suggestions: Instead of saying "Sending file over KDE Connect" I'd say "Sending file to <devicename>". Then the second line should be the filename. The Jobtracker seems to pick that automatically from the info. If you remove the "To" line from the info the filename is shown as secon line. Don't ask me how exactly this works. The end result is:

A few code nitpicks:
You should remove the commented code and debug output.
Please follow the coding style from the rest of the file. Opening { for methods go on the next line, for everything inside methods on the same line. I'll leave a few more comments as inline comments

core/backends/lan/uploadjob.cpp
61

Use Daemon::instance()->getDevice(this->m_deviceId)->name() directly and remove m_deviceName

118

Looks like too much indentation to me

This revision now requires changes to proceed.Oct 17 2018, 7:33 PM

Don't ask me how exactly this works.

Magic.

text: {
    var label = labelFileName1 || labelFileName0;
    var lastSlashIdx = label.lastIndexOf("/");
    return label.slice(lastSlashIdx + 1);
}

"To" being label 1 taking precedence over "From being label 0 :)

eduisters marked 2 inline comments as done.Oct 18 2018, 12:25 PM
eduisters updated this revision to Diff 43864.Oct 18 2018, 12:36 PM
  • Implemented requested changes
eduisters updated this revision to Diff 44378.Oct 28 2018, 7:01 PM
  • Implemented requested changes
  • QSslSocket does not detect remote disconnect when encrypedbytesToWrite() > 0 use a QTimer as a workaround
apol added a subscriber: apol.Oct 28 2018, 11:47 PM
apol added inline comments.
core/backends/lan/uploadjob.cpp
42

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

59

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

91

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

113

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

122

Wrong indentation.

182

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

eduisters marked 6 inline comments as done.Oct 29 2018, 12:03 PM
eduisters added inline comments.
core/backends/lan/uploadjob.cpp
59

I'm added Q_EMIT because the project has QT_NO_KEYWORDS defined see CMakeLists.txt line 34

91

That's the way it's done in filetranferjob.cpp

113

After stopping a transfer on desktop notification encryptedBytesWritten() is still called 1x.
After stopping a transfer on Android encryptedBytesWritten() is called 1x with bytes == the total amount of not written encrypted bytes?

eduisters updated this revision to Diff 44434.Oct 29 2018, 12:10 PM
eduisters marked 3 inline comments as done.
  • Requested changes by apol
apol added a comment.Nov 7 2018, 3:57 PM

+1 LGTM

Please see @nicolasfella's comments.

Weird. When I transfer a large file (1.8Gb) the the progress bar in the notification applet progress is way too slow and stalls at ~90 Mb. When I kill kuiserver then a window with a progress bar appears that works just fine.

eduisters updated this revision to Diff 45126.Nov 8 2018, 6:53 PM
  • Implemented requested changes
  • QSslSocket does not detect remote disconnect when encrypedbytesToWrite() > 0 use a QTimer as a workaround
  • Requested changes by apol
  • Removed timout detection when remote closes its socket because that should go into its own patch

Weird. When I transfer a large file (1.8Gb) the the progress bar in the notification applet progress is way too slow and stalls at ~90 Mb. When I kill kuiserver then a window with a progress bar appears that works just fine.

Could you try again in combination with D16758

eduisters updated this revision to Diff 45171.Nov 9 2018, 12:53 PM
  • Removed testing if file was completely received because that belongs in a patch of its own
eduisters planned changes to this revision.Nov 21 2018, 4:03 PM

Progress only needs to be shown when uploading a file

eduisters updated this revision to Diff 45970.Nov 21 2018, 6:59 PM
  • Only show progress when transferring files with size >= 0
nicolasfella accepted this revision.Nov 26 2018, 4:02 PM
This revision is now accepted and ready to land.Nov 26 2018, 4:02 PM
This revision was automatically updated to reflect the committed changes.