[vlc-devel] [PATCH 2/2] Qt playlist dialog support for file system links.

Mario Speiß 1034-135 at online.de
Sat Jan 5 22:53:41 CET 2013


Regards,
Mario
---
 modules/gui/qt4/dialogs/playlist.cpp |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/modules/gui/qt4/dialogs/playlist.cpp b/modules/gui/qt4/dialogs/playlist.cpp
index 2f2b724..6dd53b3
--- a/modules/gui/qt4/dialogs/playlist.cpp
+++ b/modules/gui/qt4/dialogs/playlist.cpp
@@ -33,6 +33,7 @@
 #include <QUrl>
 #include <QMimeData>
 #include <QHBoxLayout>
+#include <QFileInfo>
 
 PlaylistDialog::PlaylistDialog( intf_thread_t *_p_intf )
                 : QVLCMW( _p_intf )
@@ -84,11 +85,16 @@ void PlaylistDialog::dropEvent( QDropEvent *event )
 {
      const QMimeData *mimeData = event->mimeData();
      foreach( const QUrl &url, mimeData->urls() ) {
-        QString s = toNativeSeparators( url.toString() );
-        if( s.length() > 0 ) {
-            playlist_Add( THEPL, qtu(s), NULL,
+         QString mrl = toURI( url.toEncoded().constData() );
+         QFileInfo info( url.toLocalFile() );
+         if(info.exists() && info.isSymLink() )
+         {
+             mrl = info.symLinkTarget();
+             if( QFile::exists( mrl ) )
+                 mrl = "file:///" + mrl;
+         }
+         playlist_Add( THEPL, qtu(mrl), NULL,
                           PLAYLIST_APPEND, PLAYLIST_END, true, false );
-        }
      }
      event->acceptProposedAction();
 }
-- 
1.7.5.4




More information about the vlc-devel mailing list