#include "dialogs_provider.hpp"
#include "components/playlist/playlist_model.hpp"
#include "dialogs/mediainfo.hpp"
+#include "dialogs/playlist.hpp"
#include <vlc_intf_strings.h>
#include "pixmaps/types/type_unknown.xpm"
if( action == Qt::IgnoreAction )
return true;
- PLItem *targetItem;
- if( target.isValid() )
- targetItem = static_cast<PLItem*>( target.internalPointer() );
- else
- targetItem = rootItem;
+ if( !target.isValid() )
+ /* We don't want to move on an invalid position */
+ return true;
+
+ PLItem *targetItem = static_cast<PLItem*>( target.internalPointer() );
QByteArray encodedData = data->data( "vlc/playlist-item-id" );
QDataStream stream( &encodedData, QIODevice::ReadOnly );
}
for( i = 0 ; i< p_parent->i_children ; i++ )
if( p_parent->pp_children[i] == p_target ) break;
- playlist_TreeMove( p_playlist, p_src, p_parent, i );
+ // Move the item to the element after i
+ playlist_TreeMove( p_playlist, p_src, p_parent, i + 1 );
newParentItem = parentItem;
}
else
i = 0;
newParentItem = targetItem;
}
- /* Remove from source */
- PLItem *srcItem = FindById( rootItem, p_src->i_id );
- // We dropped on the source selector. Ask the dialog to forward
- // to the main view
- if( !srcItem )
- {
- emit shouldRemove( p_src->i_id );
- }
- else
- srcItem->remove( srcItem );
-
- /* Display at new destination */
- PLItem *newItem = new PLItem( p_src, newParentItem, this );
- newParentItem->insertChild( newItem, i, true );
- UpdateTreeItem( p_src, newItem, true );
- if( p_src->i_children != -1 )
- UpdateNodeChildren( newItem );
PL_UNLOCK;
}
+ /*TODO: That's not a good idea to rebuild the playlist */
+ rebuild();
}
return true;
}
if( p_item )
{
MediaInfoDialog *mid = new MediaInfoDialog( p_intf, p_item->p_input );
+ mid->setParent( PlaylistDialog::getInstance( p_intf ),
+ Qt::Dialog );
mid->show();
}
}
char *psz_meta = input_item_GetURI( p_input );
if( psz_meta )
{
- /* FIXME add a MRLSplit like function */
- QFileInfo info( qfu( psz_meta ) );
- QDesktopServices::openUrl( QUrl::fromLocalFile( info.absolutePath() ) );
+ const char *psz_access;
+ const char *psz_demux;
+ char *psz_path;
+ input_SplitMRL( &psz_access, &psz_demux, &psz_path, psz_meta );
+
+ if( EMPTY_STR( psz_access ) ||
+ !strncasecmp( psz_access, "file", 4 ) ||
+ !strncasecmp( psz_access, "dire", 4 ) )
+ {
+ QFileInfo info( qfu( psz_meta ) );
+ QDesktopServices::openUrl(
+ QUrl::fromLocalFile( info.absolutePath() ) );
+ }
free( psz_meta );
}
}