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:
@@ -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_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_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_DYN_COMPONENT NC_("RID_STR_DYN_COMPONENT", "UNO Dynamic Library Component")
|
||||||
#define RID_STR_JAVA_COMPONENT NC_("RID_STR_JAVA_COMPONENT", "UNO Java 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:
|
// collect and set filter list:
|
||||||
typedef std::map< OUString, OUString > t_string2string;
|
typedef std::map< OUString, OUString > t_string2string;
|
||||||
t_string2string title2filter;
|
t_string2string title2filter;
|
||||||
OUString sDefaultFilter( StrAllFiles::get() );
|
OUStringBuffer supportedFilters;
|
||||||
|
|
||||||
const uno::Sequence< uno::Reference< deployment::XPackageTypeInfo > > packageTypes(
|
const uno::Sequence< uno::Reference< deployment::XPackageTypeInfo > > packageTypes(
|
||||||
m_pManager->getExtensionManager()->getSupportedPackageTypes() );
|
m_pManager->getExtensionManager()->getSupportedPackageTypes() );
|
||||||
@@ -648,6 +648,9 @@ uno::Sequence< OUString > ExtMgrDialog::raiseAddPicker()
|
|||||||
const OUString title( xPackageType->getShortDescription() );
|
const OUString title( xPackageType->getShortDescription() );
|
||||||
const std::pair< t_string2string::iterator, bool > insertion(
|
const std::pair< t_string2string::iterator, bool > insertion(
|
||||||
title2filter.emplace( title, filter ) );
|
title2filter.emplace( title, filter ) );
|
||||||
|
if (!supportedFilters.isEmpty())
|
||||||
|
supportedFilters.append(';');
|
||||||
|
supportedFilters.append(filter);
|
||||||
if ( ! insertion.second )
|
if ( ! insertion.second )
|
||||||
{ // already existing, append extensions:
|
{ // already existing, append extensions:
|
||||||
OUStringBuffer buf;
|
OUStringBuffer buf;
|
||||||
@@ -656,13 +659,12 @@ uno::Sequence< OUString > ExtMgrDialog::raiseAddPicker()
|
|||||||
buf.append( filter );
|
buf.append( filter );
|
||||||
insertion.first->second = buf.makeStringAndClear();
|
insertion.first->second = buf.makeStringAndClear();
|
||||||
}
|
}
|
||||||
if ( xPackageType->getMediaType() == "application/vnd.sun.star.package-bundle" )
|
|
||||||
sDefaultFilter = title;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// All files at top:
|
// All files at top:
|
||||||
xFilePicker->appendFilter( StrAllFiles::get(), "*.*" );
|
xFilePicker->appendFilter( StrAllFiles::get(), "*.*" );
|
||||||
|
xFilePicker->appendFilter( DpResId(RID_STR_ALL_SUPPORTED), supportedFilters.makeStringAndClear() );
|
||||||
// then supported ones:
|
// then supported ones:
|
||||||
for (auto const& elem : title2filter)
|
for (auto const& elem : title2filter)
|
||||||
{
|
{
|
||||||
@@ -675,7 +677,7 @@ uno::Sequence< OUString > ExtMgrDialog::raiseAddPicker()
|
|||||||
TOOLS_WARN_EXCEPTION( "desktop", "" );
|
TOOLS_WARN_EXCEPTION( "desktop", "" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xFilePicker->setCurrentFilter( sDefaultFilter );
|
xFilePicker->setCurrentFilter( DpResId(RID_STR_ALL_SUPPORTED) );
|
||||||
|
|
||||||
if ( xFilePicker->execute() != ui::dialogs::ExecutableDialogResults::OK )
|
if ( xFilePicker->execute() != ui::dialogs::ExecutableDialogResults::OK )
|
||||||
return uno::Sequence<OUString>(); // cancelled
|
return uno::Sequence<OUString>(); // cancelled
|
||||||
|
Reference in New Issue
Block a user