save with the proper .doc variant (fdo#32219)

KFileDialog::currentFilter() returns only the pattern and not
the full filter text, so *.doc alone is ambiguous.
This commit is contained in:
Luboš Luňák 2010-12-15 15:23:52 +01:00
parent 7830760767
commit ff3f9438fb
2 changed files with 5 additions and 9 deletions

View file

@ -299,10 +299,7 @@ void SAL_CALL KDE4FilePicker::appendFilter( const ::rtl::OUString &title, const
if (!_filter.isNull())
_filter.append("\n");
//add to hash map for reverse lookup in getCurrentFilter
_filters.insert(f, t);
// '/' meed to be escaped to else they are assumed to be mime types by kfiledialog
// '/' need to be escaped else they are assumed to be mime types by kfiledialog
//see the docs
t.replace("/", "\\/");
@ -323,7 +320,10 @@ void SAL_CALL KDE4FilePicker::setCurrentFilter( const rtl::OUString &title )
rtl::OUString SAL_CALL KDE4FilePicker::getCurrentFilter()
throw( uno::RuntimeException )
{
QString filter = _filters[_dialog->currentFilter()];
// _dialog->currentFilter() wouldn't quite work, because it returns only e.g. "*.doc",
// without the description, and there may be several filters with the same pattern
QString filter = _dialog->filterWidget()->currentText();
filter.replace( "\\/", "/" );
//default if not found
if (filter.isNull())
@ -608,7 +608,6 @@ void SAL_CALL KDE4FilePicker::initialize( const uno::Sequence<uno::Any> &args )
throw( uno::Exception, uno::RuntimeException )
{
_filter.clear();
_filters.clear();
// parameter checking
uno::Any arg;

View file

@ -79,9 +79,6 @@ protected:
//running filter string to add to dialog
QString _filter;
//filter for reverse lookup of filter text
QHash<QString, QString> _filters;
//mapping of SAL control ID's to created custom controls
QHash<sal_Int16, QWidget*> _customWidgets;