[vlc-devel] [PATCH] Qt: StandardPanel: make popupExplore correctly handle uri (fix #5533).

Francois Cartegnie fcvlcdev at free.fr
Thu Apr 25 19:13:56 CEST 2013


Also handles more openable uri.
---
 .../gui/qt4/components/playlist/standardpanel.cpp  |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/standardpanel.cpp b/modules/gui/qt4/components/playlist/standardpanel.cpp
index df03917..72b053a 100644
--- a/modules/gui/qt4/components/playlist/standardpanel.cpp
+++ b/modules/gui/qt4/components/playlist/standardpanel.cpp
@@ -340,20 +340,18 @@ void StandardPLPanel::popupInfoDialog()
 
 void StandardPLPanel::popupExplore()
 {
+    QStringList schemes;
+    schemes << "file" << "smb" << "" << "ftp" << "ftps";
+
     VLCModel *model = qobject_cast<VLCModel *>(currentView->model());
     QString uri = model->getURI( popupIndex );
-    char *path = NULL;
-
-    if( ! uri.isEmpty() )
-        path = make_path( uri.toAscii().constData() );
-
-    if( path == NULL )
-        return;
 
-    QDesktopServices::openUrl(
-                QUrl::fromLocalFile( QFileInfo( qfu( path ) ).absolutePath() ) );
-
-    free( path );
+    QUrl url = QUrl::fromEncoded( qtu(uri) );
+    if ( schemes.contains( url.scheme() ) )
+    {
+        url.setPath( url.path().section( QDir::separator(), 0, -2 ) );
+        QDesktopServices::openUrl( url );
+    }
 }
 
 void StandardPLPanel::popupStream()
-- 
1.7.9




More information about the vlc-devel mailing list