+void PLSelector::plItemRemoved( int id )
+{
+ updateTotalDuration(playlistItem, "Playlist");
+ if( !podcastsParent ) return;
+
+ int c = podcastsParent->childCount();
+ for( int i = 0; i < c; i++ )
+ {
+ QTreeWidgetItem *item = podcastsParent->child(i);
+ if( item->data( 0, PL_ITEM_ID_ROLE ).toInt() == id )
+ {
+ input_item_t *p_input = item->data( 0, IN_ITEM_ROLE ).value<input_item_t*>();
+ //msg_Dbg( p_intf, "Removing podcast: (%d) %s", id, p_input->psz_uri );
+ vlc_gc_decref( p_input );
+ delete item;
+ return;
+ }
+ }
+}
+
+void PLSelector::inputItemUpdate( input_item_t *arg )
+{
+ updateTotalDuration(playlistItem, "Playlist");
+
+ if( podcastsParent == NULL )
+ return;
+
+ int c = podcastsParent->childCount();
+ for( int i = 0; i < c; i++ )
+ {
+ QTreeWidgetItem *item = podcastsParent->child(i);
+ input_item_t *p_input = item->data( 0, IN_ITEM_ROLE ).value<input_item_t*>();
+ if( p_input == arg )
+ {
+ PLSelItem *si = itemWidget( item );
+ char *psz_name = input_item_GetName( p_input );
+ si->setText( qfu( psz_name ) );
+ free( psz_name );
+ return;
+ }
+ }
+}
+
+void PLSelector::podcastAdd( PLSelItem * )
+{
+ assert( podcastsParent );
+
+ bool ok;
+ QString url = QInputDialog::getText( this, qtr( "Subscribe" ),
+ qtr( "Enter URL of the podcast to subscribe to:" ),
+ QLineEdit::Normal, QString(), &ok );
+ if( !ok || url.isEmpty() ) return;
+
+ setSource( podcastsParent ); //to load the SD in case it's not loaded
+
+ vlc_object_t *p_obj = (vlc_object_t*) vlc_object_find_name( p_intf->p_libvlc, "podcast" );
+ if( !p_obj ) return;
+
+ QString request("ADD:");
+ request += url.trimmed();
+ var_SetString( p_obj, "podcast-request", qtu( request ) );
+ vlc_object_release( p_obj );
+}
+
+void PLSelector::podcastRemove( PLSelItem* item )
+{
+ QString question ( qtr( "Do you really want to unsubscribe from %1?" ) );
+ question = question.arg( item->text() );
+ QMessageBox::StandardButton res =
+ QMessageBox::question( this, qtr( "Unsubscribe" ), question,
+ QMessageBox::Yes | QMessageBox::No,
+ QMessageBox::No );
+ if( res == QMessageBox::No ) return;
+
+ input_item_t *input = item->treeItem()->data( 0, IN_ITEM_ROLE ).value<input_item_t*>();
+ if( !input ) return;
+
+ vlc_object_t *p_obj = (vlc_object_t*) vlc_object_find_name(
+ p_intf->p_libvlc, "podcast" );
+ if( !p_obj ) return;
+
+ QString request("RM:");
+ char *psz_uri = input_item_GetURI( input );
+ request += qfu( psz_uri );
+ var_SetString( p_obj, "podcast-request", qtu( request ) );
+ vlc_object_release( p_obj );
+ free( psz_uri );
+}
+
+PLSelItem * PLSelector::itemWidget( QTreeWidgetItem *item )
+{
+ return ( static_cast<PLSelItem*>( QTreeWidget::itemWidget( item, 0 ) ) );
+}
+
+void PLSelector::drawBranches ( QPainter * painter, const QRect & rect, const QModelIndex & index ) const
+{
+ if( !model()->hasChildren( index ) ) return;
+ QStyleOption option;
+ option.initFrom( this );
+ option.rect = rect.adjusted( rect.width() - indentation(), 0, 0, 0 );
+ style()->drawPrimitive( isExpanded( index ) ?
+ QStyle::PE_IndicatorArrowDown :
+ QStyle::PE_IndicatorArrowRight, &option, painter );
+}
+
+void PLSelector::getCurrentItemInfos( int* type, bool* can_delay_search, QString *string)