diff options
author | Pascal Terjan <pterjan@mandriva.org> | 2009-01-29 17:06:31 +0000 |
---|---|---|
committer | Pascal Terjan <pterjan@mandriva.org> | 2009-01-29 17:06:31 +0000 |
commit | 96a992b4c0b9d5bc4d6d40a17e2344920e286b19 (patch) | |
tree | c4ecdaaeac997aca4ff70097f1ce39223a668f3d /perl-install | |
parent | cc67ca48bb7d2cb623a6ccf66117f06ad92466ed (diff) | |
download | drakx-96a992b4c0b9d5bc4d6d40a17e2344920e286b19.tar drakx-96a992b4c0b9d5bc4d6d40a17e2344920e286b19.tar.gz drakx-96a992b4c0b9d5bc4d6d40a17e2344920e286b19.tar.bz2 drakx-96a992b4c0b9d5bc4d6d40a17e2344920e286b19.tar.xz drakx-96a992b4c0b9d5bc4d6d40a17e2344920e286b19.zip |
Have a real fileselector in curses mode
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/NEWS | 2 | ||||
-rw-r--r-- | perl-install/install/NEWS | 1 | ||||
-rw-r--r-- | perl-install/interactive/curses.pm | 24 |
3 files changed, 27 insertions, 0 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS index dfcac2c02..f645934e5 100644 --- a/perl-install/NEWS +++ b/perl-install/NEWS @@ -1,3 +1,5 @@ +- interactive::curses: + o use a real file selector in curses too - diskdrake: o don't rewrite label when it did not change (#47186) o rewrite gpt support with libparted diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS index b54b5ea1a..964485355 100644 --- a/perl-install/install/NEWS +++ b/perl-install/install/NEWS @@ -1,3 +1,4 @@ +- use a file selector in text mode too - include mke2fs.conf from e2fsprogs-1.41.3-3mdb Version 11.80.1 - 21 January 2008 diff --git a/perl-install/interactive/curses.pm b/perl-install/interactive/curses.pm index b33caaad9..90fca4c14 100644 --- a/perl-install/interactive/curses.pm +++ b/perl-install/interactive/curses.pm @@ -539,6 +539,30 @@ sub ask_fromW_ { $v eq '0 but true' ? 0 : $v; } +sub ask_fileW { + my ($o, $opts) = @_; + my ($file, $dir); + + $dir = $opts->{directory} || $opts->{file} && dirname($opts->{file}); + + if($opts->{save}) { + $file = $o->{cui}->savefilebrowser('-title' => $opts->{title}, '-path' => $dir, '-file' => basename($file)); + } else { + $file = $o->{cui}->loadfilebrowser('-title' => $opts->{title}, '-path' => $dir, '-file' => basename($file)); + } + + my $err; + if (!$file) { + $err = N("No file chosen"); + } elsif(-f $file && $opts->{want_a_dir}) { + $file = dirname($file); + } elsif(-d $file && !$opts->{want_a_dir}) { + $err = N("You have chosen a directory, not a file"); + } elsif (!-e $file && !$opts->{save}) { + $err = $opts->{want_a_dir} ? N("No such directory") : N("No such file"); + }; + $err and $o->ask_warn('', $err) or $file; +} sub wait_messageW { my ($o, $title, $message, $message_modifiable) = @_; |