vlc/vlc-1.1 | branch: master | Rémi Denis-Courmont <[email protected]> | Wed Jul  
7 21:15:08 2010 +0300| [ab3516efb60e7713f450c542b49019d40416e1fb] | committer: 
Rémi Denis-Courmont 

Qt4: fix opening directory with special characters

(manually backported from commit a6817becf30b9e7c4d682e42128a374c8ba49ffc)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=ab3516efb60e7713f450c542b49019d40416e1fb
---

 modules/gui/qt4/dialogs_provider.cpp |   40 ++++++++++++++++++++++------------
 1 files changed, 26 insertions(+), 14 deletions(-)

diff --git a/modules/gui/qt4/dialogs_provider.cpp 
b/modules/gui/qt4/dialogs_provider.cpp
index 13dbbfa..586485c 100644
--- a/modules/gui/qt4/dialogs_provider.cpp
+++ b/modules/gui/qt4/dialogs_provider.cpp
@@ -497,22 +497,34 @@ static void openDirectory( intf_thread_t *p_intf, bool 
pl, bool go )
 {
     QString dir = QFileDialog::getExistingDirectory( NULL, qtr( 
I_OP_DIR_WINTITLE ), p_intf->p_sys->filepath );
 
-    if (!dir.isEmpty() )
+    if( dir.isEmpty() )
+        return;
+
+    QString mrl;
+
+    if( dir.endsWith( "/VIDEO_TS", Qt::CaseInsensitive ) )
+        mrl = qfu("dvd://") + toNativeSeparators( dir );
+    else
     {
-        QString mrl = (dir.endsWith( "VIDEO_TS", Qt::CaseInsensitive ) ?
-                       "dvd://" : "directory://")
-                    + toNativeSeparators( dir );
-        input_item_t *p_input = input_item_New( THEPL, qtu( mrl ), NULL );
+        char *uri = make_URI( qtu( dir ) );
+        if( unlikely(uri == NULL) )
+            return;
+        mrl = qfu(uri);
+        free( uri );
+    }
 
-        /* FIXME: playlist_AddInput() can fail */
-        playlist_AddInput( THEPL, p_input,
-                       go ? ( PLAYLIST_APPEND | PLAYLIST_GO ) : 
PLAYLIST_APPEND,
+    input_item_t *p_input = input_item_New( THEPL, qtu( mrl ), NULL );
+    if( unlikely( p_input == NULL ) )
+        return;
+
+    /* FIXME: playlist_AddInput() can fail */
+    playlist_AddInput( THEPL, p_input,
+                      go ? ( PLAYLIST_APPEND | PLAYLIST_GO ) : PLAYLIST_APPEND,
                        PLAYLIST_END, pl, pl_Unlocked );
-        RecentsMRL::getInstance( p_intf )->addRecent( mrl );
-        if( !go )
-            input_Read( THEPL, p_input );
-        vlc_gc_decref( p_input );
-    }
+    RecentsMRL::getInstance( p_intf )->addRecent( mrl );
+    if( !go )
+        input_Read( THEPL, p_input );
+    vlc_gc_decref( p_input );
 }
 
 void DialogsProvider::PLOpenDir()

_______________________________________________
vlc-commits mailing list
[email protected]
http://mailman.videolan.org/listinfo/vlc-commits

Reply via email to