[vlc-devel] [PATCH 1/2] DnD from Internet Explorer to VLC and support of links (*.lnk)

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


On Windows a Drag and Drop seems to be a Qt::LinkAction. And support for
Windows *.lnk is added.

Regards,
Mario
---
 modules/gui/qt4/main_interface.cpp |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp
index f479e4e..b0d4fd0
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -59,6 +59,7 @@
 #include <QStatusBar>
 #include <QLabel>
 #include <QStackedWidget>
+#include <QFileInfo>
 
 #include <vlc_keys.h>                       /* Wheel event */
 #include <vlc_vout_display.h>               /* vout_thread_t and VOUT_ events */
@@ -1263,7 +1264,7 @@ void MainInterface::dropEvent(QDropEvent *event)
  */
 void MainInterface::dropEventPlay( QDropEvent *event, bool b_play, bool b_playlist )
 {
-    if( event->possibleActions() & ( Qt::CopyAction | Qt::MoveAction ) )
+    if( event->possibleActions() & ( Qt::CopyAction | Qt::MoveAction | Qt::LinkAction ) )
        event->setDropAction( Qt::CopyAction );
     else
         return;
@@ -1288,6 +1289,13 @@ void MainInterface::dropEventPlay( QDropEvent *event, bool b_play, bool b_playli
         if( url.isValid() )
         {
             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 | (first ? PLAYLIST_GO: PLAYLIST_PREPARSE),
                           PLAYLIST_END, b_playlist, pl_Unlocked );
-- 
1.7.5.4




More information about the vlc-devel mailing list