Commit 0d7e31c8 authored by Kerenoc's avatar Kerenoc
Browse files

File filters for import and export dialogs

parent 3df2c1e8
......@@ -46,9 +46,11 @@ use GCExportImport;
return $self;
}
sub getSuffix
sub getFilePatterns
{
return '';
my $self = shift;
return ();
}
sub getModels
......@@ -85,6 +87,14 @@ use GCExportImport;
return 1;
}
sub getSuffix
{
my $self = shift;
return '' if ! ($self->getFilePatterns)[0];
(my $pattern = ($self->getFilePatterns)[0]->[1]) =~ s/.*?([[:alnum:]]+)/$1/;
return $pattern;
}
sub getHeader
{
}
......
......@@ -49,6 +49,11 @@ use GCExport::GCExportBase;
return "CSV";
}
sub getFilePatterns
{
return (['CSV (*.csv)', '*.csv']);
}
sub getOptions
{
my $self = shift;
......
......@@ -199,6 +199,12 @@ use GCExport::GCExportBase;
#
# return "External";
# }
sub getFilePatterns
{
return (['GCstar (*.gcs, *.gcz)', '*.gc[sz]']);
}
sub getEndInfo
{
......
......@@ -58,14 +58,12 @@ use GCExport::GCExportBase;
return "HTML";
}
sub getSuffix
sub getFilePatterns
{
my $self = shift;
return ".html";
return (['HTML (*.html)', '*.html']);
}
sub needsUTF8
sub needsUTF8
{
my $self = shift;
......
......@@ -23,7 +23,12 @@ use GCExport::GCExportBase;
my $self = shift;
return "Latex";
}
sub getFilePatterns
{
return (['LATEX (*.tex)', '*.tex']);
}
sub getOptions {
my $self = shift;
return [
......
......@@ -50,6 +50,11 @@ use GCExport::GCExportBase;
return $self;
}
sub getFilePatterns
{
return (['PDB (*.pdb)', '*.pdb']);
}
sub getOptions
{
my $self = shift;
......
......@@ -91,6 +91,11 @@ use GCExport::GCExportBase;
return "SQL";
}
sub getFilePatterns
{
return (['SQL (*.sql)', '*.sql']);
}
sub preProcess
{
my $self = shift;
......
......@@ -49,7 +49,12 @@ use GCExport::GCExportBase;
return $self;
}
sub getFilePatterns
{
return (['TarGz (*.tgz)', '*.tgz']);
}
sub wantsOsSeparator
{
return 0;
......
......@@ -61,6 +61,11 @@ use GCExport::GCExportBase;
return "Tellico";
}
sub getFilePatterns
{
return (['Tellico (*.tc)', '*.tc']);
}
sub getModels
{
......
......@@ -64,11 +64,9 @@ use GCExport::GCExportBase;
return "XML";
}
sub getSuffix
sub getFilePatterns
{
my $self = shift;
return "";
return (['XML (*.xml)', '*.xml']);
}
sub needsUTF8
......
......@@ -218,7 +218,7 @@ use GCDialogs;
$self->{file}->setType($self->{fileType}, $self->{withFilter});
}
$self->{file}->setPatternFilter($module->getFilePatterns)
if ($self->{type} eq 'import');
if ($self->{type} eq 'import' || $self->{type} eq 'export');
$module->setModel($self->{parent}->{model});
# sorter will only be created for export modules.
......@@ -502,7 +502,7 @@ use GCDialogs;
#$hbox->pack_start($labelFile,0,0,5);
$self->{fileType} = ($type eq 'import') ? 'open' : 'save';
$self->{withFilter} = ($self->{type} eq 'import') ? 1 : 0;
$self->{withFilter} = ($self->{type} =~ m/(im|ex)port/) ? 1 : 0;
$self->{file} = new GCFile($self,
$parent->{lang}->{FileChooserOpenFile},
$self->{fileType},
......
......@@ -61,7 +61,7 @@ use GCImport::GCImportBase;
sub getFilePatterns
{
return (['Tar gzip (.tar.gz)', '*.tar.gz']);
return (['Tar gzip (.tar.gz, .tgz)', '*.(tar.gz|tgz)']);
}
sub getModelName
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment