Skip to content

Remove use of tinyfiledialogs from network code #20428

Closed

Description

@jdm

Right now the engine is responsible for making UI appear to allow the user to choose an input file:

fn open_file_dialog(&self, path: &str, patterns: Vec<FilterPattern>) -> Option<String> {
if opts::get().headless {
return None;
}
let mut filter = vec![];
for p in patterns {
let s = "*.".to_string() + &p.0;
filter.push(s)
}
let filter_ref = &(filter.iter().map(|s| s.as_str()).collect::<Vec<&str>>()[..]);
let filter_opt = if filter.len() > 0 { Some((filter_ref, "")) } else { None };
tinyfiledialogs::open_file_dialog("Pick a file", path, filter_opt)
}
#[cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))]
fn open_file_dialog_multi(&self, path: &str, patterns: Vec<FilterPattern>) -> Option<Vec<String>> {
if opts::get().headless {
return None;
}
let mut filter = vec![];
for p in patterns {
let s = "*.".to_string() + &p.0;
filter.push(s)
}

Instead, the network code should send a message to the constellation, which can talk to the embedder and receive the final selection to return to the network code. This means the FileManager needs to have access to a channel which can communicate with the constellation; this can come from CoreResourceManager::new via new_resource_threads. This is a good model for communicating with the embedder from the constellation.

To test this code, verify that it's possible to submit an HTML form that includes a <input type="select"> element after choosing a file.

Activity

  1. added
    I-refactor
    E-more-complex
    on Mar 25, 2018
  2. kwonoj commented on Mar 25, 2018

    @kwonoj
    Contributor

    @jdm mind if I try to give a shot for this?

  3. jdm commented on Mar 25, 2018

    @jdm
    MemberAuthor

    Go for it!

  4. added
    C-assigned
    on Mar 25, 2018
  5. kwonoj commented on Mar 25, 2018

    @kwonoj
    Contributor

    🙇‍♂️ @highfive assign me

  6. highfive commented on Mar 25, 2018

    @highfive

    It looks like this has already been assigned to someone. I'll leave the decision to a core contributor.

  7. added 7 commits that reference this issue on Apr 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-embeddingA-networkC-assignedE-more-complexI-refactor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions