Commit 934eee8c authored by Mario Speiß's avatar Mario Speiß Committed by Jean-Baptiste Kempf

DnD from Internet Explorer to VLC and support of links (*.lnk)

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

Playlist widget now uses the p_mi->dropEvent (used to have two implementation,
one calling p_mi->dropEvent already, the other had its own body. That body is
removed)

Regards,
Mario
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 7b621263
...@@ -82,15 +82,7 @@ PlaylistDialog::~PlaylistDialog() ...@@ -82,15 +82,7 @@ PlaylistDialog::~PlaylistDialog()
void PlaylistDialog::dropEvent( QDropEvent *event ) void PlaylistDialog::dropEvent( QDropEvent *event )
{ {
const QMimeData *mimeData = event->mimeData(); playlistWidget->dropEvent(event);
foreach( const QUrl &url, mimeData->urls() ) {
QString s = toNativeSeparators( url.toString() );
if( s.length() > 0 ) {
playlist_Add( THEPL, qtu(s), NULL,
PLAYLIST_APPEND, PLAYLIST_END, true, false );
}
}
event->acceptProposedAction();
} }
void PlaylistDialog::dragEnterEvent( QDragEnterEvent *event ) void PlaylistDialog::dragEnterEvent( QDragEnterEvent *event )
{ {
......
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
#include <QStatusBar> #include <QStatusBar>
#include <QLabel> #include <QLabel>
#include <QStackedWidget> #include <QStackedWidget>
#include <QFileInfo>
#include <vlc_keys.h> /* Wheel event */ #include <vlc_keys.h> /* Wheel event */
#include <vlc_vout_display.h> /* vout_thread_t and VOUT_ events */ #include <vlc_vout_display.h> /* vout_thread_t and VOUT_ events */
...@@ -1268,7 +1269,7 @@ void MainInterface::dropEvent(QDropEvent *event) ...@@ -1268,7 +1269,7 @@ void MainInterface::dropEvent(QDropEvent *event)
*/ */
void MainInterface::dropEventPlay( QDropEvent *event, bool b_play, bool b_playlist ) 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 ); event->setDropAction( Qt::CopyAction );
else else
return; return;
...@@ -1293,6 +1294,23 @@ void MainInterface::dropEventPlay( QDropEvent *event, bool b_play, bool b_playli ...@@ -1293,6 +1294,23 @@ void MainInterface::dropEventPlay( QDropEvent *event, bool b_play, bool b_playli
if( url.isValid() ) if( url.isValid() )
{ {
QString mrl = toURI( url.toEncoded().constData() ); QString mrl = toURI( url.toEncoded().constData() );
QFileInfo info( url.toLocalFile() );
if( info.exists() && info.isSymLink() )
{
QString target = info.symLinkTarget();
QUrl url;
if( QFile::exists( target ) )
{
url = QUrl::fromLocalFile( target );
}
else
{
url.setUrl( target );
}
mrl = toURI( url.toEncoded().constData() );
}
if( mrl.length() > 0 )
{
playlist_Add( THEPL, qtu(mrl), NULL, playlist_Add( THEPL, qtu(mrl), NULL,
PLAYLIST_APPEND | (first ? PLAYLIST_GO: PLAYLIST_PREPARSE), PLAYLIST_APPEND | (first ? PLAYLIST_GO: PLAYLIST_PREPARSE),
PLAYLIST_END, b_playlist, pl_Unlocked ); PLAYLIST_END, b_playlist, pl_Unlocked );
...@@ -1300,6 +1318,7 @@ void MainInterface::dropEventPlay( QDropEvent *event, bool b_play, bool b_playli ...@@ -1300,6 +1318,7 @@ void MainInterface::dropEventPlay( QDropEvent *event, bool b_play, bool b_playli
RecentsMRL::getInstance( p_intf )->addRecent( mrl ); RecentsMRL::getInstance( p_intf )->addRecent( mrl );
} }
} }
}
/* Browsers give content as text if you dnd the addressbar, /* Browsers give content as text if you dnd the addressbar,
so check if mimedata has valid url in text and use it so check if mimedata has valid url in text and use it
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment