Skip to content

Selecting multiple files / directories is not actually implemented. #1067

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

Open
TheNeikos opened this issue Jun 29, 2020 · 5 comments
Open

Selecting multiple files / directories is not actually implemented. #1067

TheNeikos opened this issue Jun 29, 2020 · 5 comments
Labels
bug does not behave the way it is supposed to help wanted has no one working on it yet

Comments

@TheNeikos
Copy link

A bug I ran into just now:

I currently have:

    let dialog_options = FileDialogOptions::new()
        .select_directories()
        .multi_selection();

    let window = WindowDesc::new(build_schauglas)
        .menu(MenuDesc::new(LocalizedString::new("menubar")).append(
            MenuDesc::new(LocalizedString::new("file").with_placeholder("File")).append(
                MenuItem::new(
                    LocalizedString::new("open").with_placeholder("Open"),
                    Command::new(SHOW_OPEN_PANEL, dialog_options),
                ),
            ),
        ));

And in my delegate, I am simply printing out whatever command gets in:

      -> bool {
        debug!("Cmd: {:?}", cmd);
        if let Some(file_info) = cmd.get(OPEN_FILE) {
            return true;
        }

        false
    }

this gives me the following outputs:

  • When selecting a single directory: Cmd: Command { symbol: "druid-builtin.open-file-path", payload: Any }
  • When selecting multiple:

Info:

  • Windows 10
  • Druid 0.6
@luleyleo
Copy link
Collaborator

luleyleo commented Jun 29, 2020

Now this one is interesting.

It seems like the options for selecting multiple files / directories were added in #616, yet they have never been implemented.
Enabling multi_selection does set the flag for the dialog, but does not handle the result correctly (It just expects a single file).
On Windows it apparently returns nothing, on GTK it just returns the uppermost selected file, not sure what the effect on macOS is.

To make this work we would also have to change OPEN_FILE to take a Vec<FileInfo> as payload and change WindowHandle::open_file_sync to return Vec<FileInfo>.

@luleyleo luleyleo changed the title No command sent when selecting multiple directories in SHOW_OPEN_PANEL Selecting multiple files / directories is not actually implemented. Jun 29, 2020
@cmyr cmyr added the bug does not behave the way it is supposed to label Jul 4, 2020
@cmyr
Copy link
Member

cmyr commented Jul 4, 2020

Huh yea this is an oversight. Agree with @Finnerale about the required API changes.

@cmyr cmyr added the help wanted has no one working on it yet label Jul 4, 2020
@raphlinus
Copy link
Contributor

Since we want get rid of the sync call to deal with #1068, maybe we can roll up both API changes at the same time.

@cmyr
Copy link
Member

cmyr commented Jul 4, 2020

I also think we might want to unify file opening to use whatever API we end up with for modals alerts; see #1039.

@atlanticaccent
Copy link

Hi, it'd be great if this were to be implemented for Windows too.

I do think it should be called out in the FileDialogOption docs that this is not implemented on Windows yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug does not behave the way it is supposed to help wanted has no one working on it yet
Projects
None yet
Development

No branches or pull requests

5 participants