Skip to content

SocketAPI: Make it easier to add or remove item in the action menu - #6315

Merged
ogoffart merged 5 commits into
masterfrom
socketapi
Jan 23, 2018
Merged

ogoffart merged 5 commits into
masterfrom
socketapi

Conversation

@ogoffart

Copy link
Copy Markdown
Contributor

By making it dynamic.
So far only the nautilus and dolphin shell extension have been ported

@ogoffart
ogoffart requested a review from ckamm January 18, 2018 14:23
@michaelstingl

Copy link
Copy Markdown
Contributor

sounds 🆒 😎

@ogoffart

Copy link
Copy Markdown
Contributor Author

The reason to do that is that the new placeholder change might want to add entries in this menu, and so it would be much easier if we can change easily the entries without having to modify every shell extension.

So far I only did the change to nautilus and dolphin. Waiting for feedback before doing the rest.

The filter parametter is a regexp to on the whole filename. And the filename is made to ends with '/' for directories.
So we can have special entries for directories, or .owncloud files.
I realized when porting nautilus that it only add entries on files that have the OK status, this might be a problem and something we might want to encode in the filter instead.

Also i just tought perhaps there should be a way to set the icon

@SamuAlfageme

Copy link
Copy Markdown
Contributor

Some relevant tickets that'd benefit from this: #5903 (if I understood correctly) and, on a deeper level: #6292

@ogoffart

Copy link
Copy Markdown
Contributor Author

@SamuAlfageme Yes, this would help for all these issue.

There are some issues about graying out the menu for files that can be shared and so on. So I need to brainstorm with @ckamm on smarter filter.
An idea i had was that we could add one more string in the "STATUS:" replies or update and filter on that instead of on the name. That would work fine for Nautilus in which all extension are the same. That would somehow work for windows because we do synchronous query anyway we can as well query the status.
But for Dolphin that might be harder because the action plugin don't have access to the status right now.

We also need to encode in the filter if we should disable or remove the options.
Also some options might be valid if there is a multiple selection.

@ckamm

ckamm commented Jan 19, 2018 •

Copy link
Copy Markdown
Contributor

@SamuAlfageme @ogoffart To make it easier to think about this, here's a list of behaviors we want:

  1. Placeholder files should have a "Download this file" menu action, not others.
  2. Files (not directories) might have a "Remove local copy, keep remote" menu action to convert back to placeholder only.
  3. If the server has sharing disabled the "Share..." action should be hidden.
  4. For files that can't be shared the "Share..." action should be disabled. (Problem: User doesn't understand why)
  5. If the client isn't connected the "Share..." action should be disabled. (Problem: User doesn't understand why)
  6. All private link related options also only work when the account is connected.
  7. It should be easy to add new simple actions that just trigger some behavior in the client.
  8. Maybe multiaccount issues - but it's so far out of usual user behavior that I'd not worry overmuch

I did not fully get whether #4608 and #6252 are related too.

It seems 1. and 2. can be done with the filters @ogoffart added.

For 3. we'd need to be able to control menus on a per-sync-folder level.

Number 4 is hard, it means the shell integration needs to know about "is sharable" status of each file?

For 5. and 6. the client would need to report connectivity per sync folder.

Number 7 is done with this patch

By making it dynamic.
So far only the dolphin shell extension have been ported
ogoffart and others added 3 commits January 19, 2018 14:02
Previously no menu would ever be shown if more than one file is
selected. Now the GET_MENU_ITEMS command is sent with all selected files
as an argument - similar to what is done for the dolphin integration.
return {};
}
socket.SendMsg(L"GET_STRINGS\n");
socket.SendMsg(L"GET_STRINGS:CONTEXT_MENU_TITLE\n");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you can request a particular string only right now.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the change in SocketApi::command_GET_STRINGS

return false;
}

auto thirdCollon = source.find(L':', statusEnd + 1);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thirdColon

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will fix

return false;
}

auto thirdCollon = source.find(L':', statusEnd + 1);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will fix

Comment thread src/gui/socketapi.cpp
listener->sendMessage(QString("GET_STRINGS:BEGIN"));
for (auto key_value : strings) {
listener->sendMessage(QString("STRING:%1:%2").arg(key_value.first, key_value.second));
if (argument.isEmpty() || argument == QLatin1String(key_value.first)) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ckamm: This change allow to request a special string.

return {};
}
socket.SendMsg(L"GET_STRINGS\n");
socket.SendMsg(L"GET_STRINGS:CONTEXT_MENU_TITLE\n");

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the change in SocketApi::command_GET_STRINGS

@ogoffart
ogoffart merged commit 883080b into master Jan 23, 2018
@ogoffart
ogoffart deleted the socketapi branch January 23, 2018 13:03
Comment thread src/gui/socketapi.cpp
void SocketApi::command_GET_MENU_ITEMS(const QString &argument, OCC::SocketListener *listener)
{
listener->sendMessage(QString("GET_MENU_ITEMS:BEGIN"));
bool hasSeveralFiles = argument.contains(QLatin1Char('\x1e')); // Record Separator

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So while the extensions do support selecting and then querying multiple files, the client does not yet do I understand this correctly? @ogoffart @ckamm

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The placeholder branch does.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, you can ask to download multiple placeholders at once with this functionality :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants