aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2019-12-10 18:10:30 +0000
committerRobin Krahl <robin.krahl@ireas.org>2019-12-10 19:56:19 +0100
commit1b50ae033b646db0efc8ea0917685a3a0c8bfc94 (patch)
treed19e5cc9084b6718817c75220465db645876ff9a /src
parent2f3e2b5474834e3d733edf09b831c5607d451f49 (diff)
downloaddialog-rs-1b50ae033b646db0efc8ea0917685a3a0c8bfc94.tar.gz
dialog-rs-1b50ae033b646db0efc8ea0917685a3a0c8bfc94.tar.bz2
Implement show_file_selection for kdialog backend
This patch adds an implementation of Backend’s show_file_selection function to the KDialog backend, using KDialog’s --getopenfilename option.
Diffstat (limited to 'src')
-rw-r--r--src/backends/kdialog.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/backends/kdialog.rs b/src/backends/kdialog.rs
index c2ddcd0..e556ddf 100644
--- a/src/backends/kdialog.rs
+++ b/src/backends/kdialog.rs
@@ -4,7 +4,7 @@
use std::process;
-use crate::{Choice, Error, Input, Message, Password, Question, Result};
+use crate::{Choice, Error, FileSelection, Input, Message, Password, Question, Result};
/// Subprocess exit codes
///
@@ -136,4 +136,11 @@ impl super::Backend for KDialog {
self.execute(args, &question.title)
.and_then(|output| get_choice(output.status))
}
+
+ fn show_file_selection(&self, file_selection: &FileSelection) -> Result<Option<String>> {
+ let dir = file_selection.path_to_string().ok_or("path not valid")?;
+ let args = vec!["--getopenfilename", &dir];
+ self.execute(args, &file_selection.title)
+ .and_then(get_stdout)
+ }
}