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

Rafaël Carré funman at videolan.org
Sun Jan 6 11:45:19 CET 2013


Hello,

Le 05/01/2013 22:53, Mario Speiß a écrit :
> 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;

mrl needs to be URL-encoded: The correct MRL for file path C:\ß.avi is
file:///c:/%C3%9F.avi

> +            }
>              playlist_Add( THEPL, qtu(mrl), NULL,
>                            PLAYLIST_APPEND | (first ? PLAYLIST_GO: PLAYLIST_PREPARSE),
>                            PLAYLIST_END, b_playlist, pl_Unlocked );
> 




More information about the vlc-devel mailing list