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

Ability to set the description for nwdirectory in "Browse for Folder" dialog #5265

Closed
ghost opened this issue Sep 3, 2016 · 18 comments
Closed
Assignees

Comments

@ghost
Copy link

ghost commented Sep 3, 2016

I am using nwdirectory attribute to an input="file" field in order to trigger the "Browse for Folder" dialog. However the description on the dialog is misleading, I don't want to "upload" a folder, but rather choose a folder. It can also give a wrong impression to the user, that you are actually going to upload his, often private, files somewhere.

browsefolder

Could we have an extra attribute nwdirectorydesc that would allow us to set that description? Like so,

<input id="folder-open-dialog" type="file" style="display: none;" nwdirectory nwworkingdir="" nwdirectorydesc="Please select a folder" role="hidden" />

@motla
Copy link

motla commented Sep 7, 2016

+1

@octachrome
Copy link

@rogerwang I considered trying to fix this, but after looking through the source code I'm confused about why the message reads "Select Folder to Upload".

  • I checked out nwjs/chromium.src and looked for the string "Select Folder to Upload" - it only occurs as part of the label IDS_SELECT_UPLOAD_FOLDER_DIALOG_TITLE.
  • I looked for usages of the label - it is only used when the file select helper is opened with dialog type set to SELECT_UPLOAD_FOLDER.
  • I checked the nwjs/nw.js source, and SELECT_UPLOAD_FOLDER is never used - NW.js only uses SELECT_FOLDER, which should result in the label IDS_SELECT_FOLDER_DIALOG_TITLE being used instead, which reads "Select Folder".

Do you have any idea how/why the "Select Folder to Upload" label is being used?

I am using branch nw22.

@rogerwang
Copy link
Member

Thanks. You can check the following files:
ui/shell_dialogs/select_file_dialog_win.cc
chrome/browser/ui/libgtkui/select_file_dialog_impl_gtk.cc
chrome/browser/ui/libgtkui/select_file_dialog_impl_kde.cc

@octachrome
Copy link

@rogerwang The reason I was confused is because I was assuming that nw.js/src/browser/file_select_helper.cc was used instead of chromium.src/chrome/src/browser/file_select_helper.cc. However, debugging shows that this is not the case. The version of RunFileChooserOnUIThread in NW.js passes SELECT_FOLDER as expected, whereas the Chromium version of RunFileChooserOnUIThread passes SELECT_UPLOAD_FOLDER. The Chromium version of the function is being invoked, so the wrong message is being displayed.

What is the relationship between these two source files?

@octachrome
Copy link

@rogerwang Can you shed any light on this?

@rogerwang
Copy link
Member

rogerwang commented May 15, 2017 via email

@octachrome
Copy link

@rogerwang OK. I propose reapplying the following change to chrome/browser/file_select_helper.cc:

-      dialog_type_ = ui::SelectFileDialog::SELECT_UPLOAD_FOLDER;
+      dialog_type_ = ui::SelectFileDialog::SELECT_FOLDER;

As originally committed in c5ef962.

I can do a pull request, but I'm not sure which branch to fork. I can see that chromium.src/nw22 has the entire NW.js changeset squashed and rebased onto it, so I'm guessing a pull request onto that branch would not be useful to you...

@octachrome
Copy link

@rogerwang What do you think of my suggestion?

@octachrome
Copy link

@rogerwang Do you (or someone else) have time to look at my suggestion? I am very happy to spend time working on this issue if it helps to resolve it, but I need some feedback :)

@rogerwang
Copy link
Member

Sure, will look to fix it with your patch.

@rogerwang rogerwang self-assigned this Jun 12, 2017
@Pabloandumundu
Copy link

In nw.js version 0.23.6 for windows still appear "Select Folder to Upload". That message is very horrible when you create an application where files are handled locally.

@charlielee
Copy link
Contributor

charlielee commented Dec 22, 2017

@octachrome @rogerwang I was wondering what the status of this issue/bug is. It is still present in v0.26+. Many thanks :)

@octachrome
Copy link

@rogerwang I would also like to know the status of this. It seems like a really simple fix, unless there is something I don't understand about it, but it has been many months and many posts to this thread and it is still not resolved.

Is there some way we can help with this? By creating a pull request? Or something else?

@rogerwang
Copy link
Member

rogerwang commented Dec 31, 2017 via email

@rogerwang
Copy link
Member

Just fixed this in nw28 branch. Added nwdirectorydesc as proposed and changed the default string to Select Folder. It will be available in the next 0.28.0-rc1 build.

rogerwang added a commit that referenced this issue Jan 3, 2018
@octachrome
Copy link

Thanks, really appreciated!

@rogerwang
Copy link
Member

@octachrome
Copy link

@rogerwang I have updated to 0.28 and this works perfectly now. Many thanks!

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

No branches or pull requests

6 participants