Add "All supported files" filter to extension add dialog
Did you know you can install xcu files directly via extension manager? Now it should be easier to discover... Change-Id: I9a96708fd13f762b20916540e6fa9b87bb582677 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100176 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
This commit is contained in:
parent
0e8681d4a1
commit
6a32706e7c
@ -44,6 +44,7 @@
|
||||
#define RID_STR_CANNOT_DETERMINE_LIBNAME NC_("RID_STR_CANNOT_DETERMINE_LIBNAME", "The library name could not be determined.")
|
||||
|
||||
#define RID_STR_PACKAGE_BUNDLE NC_("RID_STR_PACKAGE_BUNDLE", "Extension")
|
||||
#define RID_STR_ALL_SUPPORTED NC_("RID_STR_PACKAGE_BUNDLE", "All supported files")
|
||||
|
||||
#define RID_STR_DYN_COMPONENT NC_("RID_STR_DYN_COMPONENT", "UNO Dynamic Library Component")
|
||||
#define RID_STR_JAVA_COMPONENT NC_("RID_STR_JAVA_COMPONENT", "UNO Java Component")
|
||||
|
@ -635,7 +635,7 @@ uno::Sequence< OUString > ExtMgrDialog::raiseAddPicker()
|
||||
// collect and set filter list:
|
||||
typedef std::map< OUString, OUString > t_string2string;
|
||||
t_string2string title2filter;
|
||||
OUString sDefaultFilter( StrAllFiles::get() );
|
||||
OUStringBuffer supportedFilters;
|
||||
|
||||
const uno::Sequence< uno::Reference< deployment::XPackageTypeInfo > > packageTypes(
|
||||
m_pManager->getExtensionManager()->getSupportedPackageTypes() );
|
||||
@ -648,6 +648,9 @@ uno::Sequence< OUString > ExtMgrDialog::raiseAddPicker()
|
||||
const OUString title( xPackageType->getShortDescription() );
|
||||
const std::pair< t_string2string::iterator, bool > insertion(
|
||||
title2filter.emplace( title, filter ) );
|
||||
if (!supportedFilters.isEmpty())
|
||||
supportedFilters.append(';');
|
||||
supportedFilters.append(filter);
|
||||
if ( ! insertion.second )
|
||||
{ // already existing, append extensions:
|
||||
OUStringBuffer buf;
|
||||
@ -656,13 +659,12 @@ uno::Sequence< OUString > ExtMgrDialog::raiseAddPicker()
|
||||
buf.append( filter );
|
||||
insertion.first->second = buf.makeStringAndClear();
|
||||
}
|
||||
if ( xPackageType->getMediaType() == "application/vnd.sun.star.package-bundle" )
|
||||
sDefaultFilter = title;
|
||||
}
|
||||
}
|
||||
|
||||
// All files at top:
|
||||
xFilePicker->appendFilter( StrAllFiles::get(), "*.*" );
|
||||
xFilePicker->appendFilter( DpResId(RID_STR_ALL_SUPPORTED), supportedFilters.makeStringAndClear() );
|
||||
// then supported ones:
|
||||
for (auto const& elem : title2filter)
|
||||
{
|
||||
@ -675,7 +677,7 @@ uno::Sequence< OUString > ExtMgrDialog::raiseAddPicker()
|
||||
TOOLS_WARN_EXCEPTION( "desktop", "" );
|
||||
}
|
||||
}
|
||||
xFilePicker->setCurrentFilter( sDefaultFilter );
|
||||
xFilePicker->setCurrentFilter( DpResId(RID_STR_ALL_SUPPORTED) );
|
||||
|
||||
if ( xFilePicker->execute() != ui::dialogs::ExecutableDialogResults::OK )
|
||||
return uno::Sequence<OUString>(); // cancelled
|
||||
|
Loading…
x
Reference in New Issue
Block a user