[Libreoffice-commits] .: 2 commits - fpicker/source

Lubos Lunak llunak at kemper.freedesktop.org
Wed Dec 15 06:30:29 PST 2010


 fpicker/source/unx/kde4/KDE4FilePicker.cxx |   13 ++++++-------
 fpicker/source/unx/kde4/KDE4FilePicker.hxx |    3 ---
 2 files changed, 6 insertions(+), 10 deletions(-)

New commits:
commit e90aab5fdcd03c2efcf5671bb451d2b68c70dc19
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Wed Dec 15 15:23:52 2010 +0100

    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.

diff --git a/fpicker/source/unx/kde4/KDE4FilePicker.cxx b/fpicker/source/unx/kde4/KDE4FilePicker.cxx
index d08a040..e9b71a3 100644
--- a/fpicker/source/unx/kde4/KDE4FilePicker.cxx
+++ b/fpicker/source/unx/kde4/KDE4FilePicker.cxx
@@ -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;
diff --git a/fpicker/source/unx/kde4/KDE4FilePicker.hxx b/fpicker/source/unx/kde4/KDE4FilePicker.hxx
index e806c11..e1b8a15 100644
--- a/fpicker/source/unx/kde4/KDE4FilePicker.hxx
+++ b/fpicker/source/unx/kde4/KDE4FilePicker.hxx
@@ -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;
     
commit eb299e9d1524667e9da982d3614a61f45ea2a8e6
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Wed Dec 15 14:57:28 2010 +0100

    minor fix in a comment

diff --git a/fpicker/source/unx/kde4/KDE4FilePicker.cxx b/fpicker/source/unx/kde4/KDE4FilePicker.cxx
index 8594f7e..d08a040 100644
--- a/fpicker/source/unx/kde4/KDE4FilePicker.cxx
+++ b/fpicker/source/unx/kde4/KDE4FilePicker.cxx
@@ -198,7 +198,7 @@ sal_Int16 SAL_CALL KDE4FilePicker::execute()
     // (see the KDE VCL plug), then this won't happen, but otherwise
     // simply release the SolarMutex here. The KDE file dialog does not
     // call back to the core, so this should be safe (and if it does,
-    // SolarMutex will need to be re-acquired.
+    // SolarMutex will need to be re-acquired).
     ULONG mutexrelease = 0;
     if( !qApp->clipboard()->property( "useEventLoopWhenWaiting" ).toBool())
         mutexrelease = Application::ReleaseSolarMutex();


More information about the Libreoffice-commits mailing list