Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Add multiple file transfer, directory transfer from Nautilus #1821

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

ferdnyc
Copy link
Member

@ferdnyc ferdnyc commented May 31, 2024

This PR adds the ability to transfer multiple files at once over the KDEConnect "share files" link, and upgrades the Nautilus/Nemo extension with the ability to both handle multi-select (sending all of the selected items), and to send directory trees via temporarily-created .zip files, which are deleted by the JS code after transferring the files (successfully or not).

Fixes: #1025

@ferdnyc
Copy link
Member Author

ferdnyc commented May 31, 2024

I also added a commit setting the flake8 maximum line length to 80, because there was a conflict where black would reformat a statement of exactly 80 characters to one line, then flake8 would complain about it and want it wrapped, but then black would want to reformat it back to one line... Pulled out to a separate PR.

@ferdnyc
Copy link
Member Author

ferdnyc commented May 31, 2024

I'll have to figure out what about these changes are breaking testSharePlugin.js, plus it would be good to add some new tests for the new functionality.

@ferdnyc ferdnyc marked this pull request as draft May 31, 2024 19:37
@ferdnyc
Copy link
Member Author

ferdnyc commented Jun 12, 2024

@andyholmes I was hoping you might be able to give me some insight into why the CI is failing.

The failure is in testSharePlugin.js, which makes sense as that's the plugin I modified. The specific failure is test 2, "The share plugin enables its GActions when connected". Here's that portion of gsconnect_plugins_testSharePlugin.test.txt:

not ok 2 The share plugin enables its GActions when connected
# Message: Expected false to be true.
# Stack:
#   error properties: Object({ matches: Function })
#   @file:///usr/libexec/installed-tests/gsconnect/plugins/testSharePlugin.js:58:67
#   setTimeout/source<@resource:///org/gnome/gjs/modules/esm/_timers.js:72:9
#   _init/GLib.MainLoop.prototype.runAsync/</<@resource:///org/gnome/gjs/modules/core/overrides/GLib.js:266:34
# Message: Expected false to be true.
# Stack:
#   error properties: Object({ matches: Function })
#   @file:///usr/libexec/installed-tests/gsconnect/plugins/testSharePlugin.js:58:67
#   setTimeout/source<@resource:///org/gnome/gjs/modules/esm/_timers.js:72:9
#   _init/GLib.MainLoop.prototype.runAsync/</<@resource:///org/gnome/gjs/modules/core/overrides/GLib.js:266:34
# Message: Expected false to be true.
# Stack:
#   error properties: Object({ matches: Function })
#   @file:///usr/libexec/installed-tests/gsconnect/plugins/testSharePlugin.js:61:68
#   setTimeout/source<@resource:///org/gnome/gjs/modules/esm/_timers.js:72:9
#   _init/GLib.MainLoop.prototype.runAsync/</<@resource:///org/gnome/gjs/modules/core/overrides/GLib.js:266:34
# Message: Expected false to be true.
# Stack:
#   error properties: Object({ matches: Function })
#   @file:///usr/libexec/installed-tests/gsconnect/plugins/testSharePlugin.js:61:68
#   setTimeout/source<@resource:///org/gnome/gjs/modules/esm/_timers.js:72:9
#   _init/GLib.MainLoop.prototype.runAsync/</<@resource:///org/gnome/gjs/modules/core/overrides/GLib.js:266:34

I did add a couple of new actions to the plugin. The only reason I can think of that they might not be activating is, both of the new actions have kdeconnect.share.request.update as one of their outgoing message types; that message is also added to the outgoingCapabilities of the plugin itself.

testSharePlugin.js currently configures its test rig with only the kdeconnect.share.request message as both incoming and outgoing:

beforeAll(async function () {
testRig = new Utils.TestRig();
await testRig.prepare({
localDevice: {
incomingCapabilities: [
'kdeconnect.share.request',
],
outgoingCapabilities: [
'kdeconnect.share.request',
],
},
remoteDevice: {
incomingCapabilities: [
'kdeconnect.share.request',
],
outgoingCapabilities: [
'kdeconnect.share.request',
],
},
});
testRig.setPaired(true);

Do I need to add kdeconnect.share.request.update to the test rig, to get the new actions to auto-enable? At which endpoint(s)?

@ferdnyc
Copy link
Member Author

ferdnyc commented Jun 12, 2024

As I've said, it would also be good to add actual tests for the new code. But I figure first I need to get the tests working without testing the new code, before I worry about adding more tests.

@andyholmes
Copy link
Collaborator

This is the section here that controls enabling/disabling actions:

connected() {
// Enabled based on device capabilities, which might change
const incoming = this.device.settings.get_strv('incoming-capabilities');
const outgoing = this.device.settings.get_strv('outgoing-capabilities');
for (const action of this._gactions) {
const info = this._meta.actions[action.name];
if (info.incoming.every(type => outgoing.includes(type)) &&
info.outgoing.every(type => incoming.includes(type)))
action.set_enabled(true);
}
}

So as long as every incoming/outgoing packet type for the action is also in the incoming/outgoing for the device, it will be enabled. So I'd guess what you need is to add kdeconnect.share.request.update to both sides of the test rig.

@ferdnyc
Copy link
Member Author

ferdnyc commented Jun 12, 2024

@andyholmes That seems to have done it, thanks!

Now I just have to gin up some tests for the new code.

@github-actions github-actions bot added the conflicts Pull requests with merge conflicts that need to be resolved label Oct 13, 2024
Copy link

This pull request has conflicts, please resolve those so that the changes can be evaluated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conflicts Pull requests with merge conflicts that need to be resolved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GSConnect cannot send multiple files at once
2 participants