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

Rémi Denis-Courmont remi at remlab.net
Sun Jan 6 21:39:00 CET 2013


Le dimanche 6 janvier 2013 18:52:18, Mario Speiß a écrit :
> On Windows a Drag and Drop seems to be a Qt::LinkAction. And support for
> file system links is added.
> 
> Hopefully the encoding of the URL is now correct.
> 
> Regards,
> Mario
> ---
>  modules/gui/qt4/dialogs/playlist.cpp |   17 +++++++++++++----
>  modules/gui/qt4/main_interface.cpp   |   21 +++++++++++++++++----
>  2 files changed, 30 insertions(+), 8 deletions(-)
> 
> diff --git a/modules/gui/qt4/dialogs/playlist.cpp
> b/modules/gui/qt4/dialogs/playlist.cpp index 2f2b724..3a5dc4b
> --- 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,19 @@ 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() );
> +         QVLCFileInfo info( url.toLocalFile() );
> +         if( info.exists() && info.isSymLink() )
> +         {
> +             QString target = info.symLinkTarget();
> +             QUrl url;
> +             if( QFile::exists( target ) )
> +                 url = QUrl::fromLocalFile( target );
> +             mrl = toURI( url.toEncoded().constData() );
> +         }
> +         if( mrl.length() > 0 )
> +             playlist_Add( THEPL, qtu(mrl), NULL,
>                            PLAYLIST_APPEND, PLAYLIST_END, true, false );
> -        }

I don't see the point in converting the string from file path into an URI and 
then back into a file path...

>       }
>       event->acceptProposedAction();
>  }

-- 
Rémi Denis-Courmont
http://www.remlab.net/



More information about the vlc-devel mailing list