dad88347bdf310911d0adab2f023a6da3408cd7a
[vlc.git] / modules / gui / qt4 / dialogs_provider.cpp
1 /*****************************************************************************
2  * dialogs_provider.cpp : Dialog Provider
3  *****************************************************************************
4  * Copyright (C) 2006-2009 the VideoLAN team
5  * $Id$
6  *
7  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
8  *          Jean-Baptiste Kempf <jb@videolan.org>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25 #ifdef HAVE_CONFIG_H
26 # include "config.h"
27 #endif
28
29 #include <vlc_intf_strings.h>
30
31 #include "qt4.hpp"
32 #include "dialogs_provider.hpp"
33 #include "input_manager.hpp" /* Load Subtitles */
34 #include "menus.hpp"
35 #include "recents.hpp"
36 #include "util/qt_dirs.hpp"
37
38 /* The dialogs */
39 #include "dialogs/playlist.hpp"
40 #include "dialogs/bookmarks.hpp"
41 #include "dialogs/preferences.hpp"
42 #include "dialogs/mediainfo.hpp"
43 #include "dialogs/messages.hpp"
44 #include "dialogs/extended.hpp"
45 #include "dialogs/vlm.hpp"
46 #include "dialogs/sout.hpp"
47 #include "dialogs/convert.hpp"
48 #include "dialogs/open.hpp"
49 #include "dialogs/openurl.hpp"
50 #include "dialogs/help.hpp"
51 #include "dialogs/gototime.hpp"
52 #include "dialogs/podcast_configuration.hpp"
53 #include "dialogs/toolbar.hpp"
54 #include "dialogs/plugins.hpp"
55 #include "dialogs/external.hpp"
56
57 #include <QEvent>
58 #include <QApplication>
59 #include <QSignalMapper>
60 #include <QFileDialog>
61
62
63 DialogsProvider* DialogsProvider::instance = NULL;
64
65 DialogsProvider::DialogsProvider( intf_thread_t *_p_intf ) :
66                                   QObject( NULL ), p_intf( _p_intf )
67 {
68     b_isDying = false;
69
70     /* Various signal mappers for the menus */
71     menusMapper = new QSignalMapper();
72     CONNECT( menusMapper, mapped(QObject *), this, menuAction( QObject *) );
73
74     menusUpdateMapper = new QSignalMapper();
75     CONNECT( menusUpdateMapper, mapped(QObject *),
76              this, menuUpdateAction( QObject *) );
77
78     SDMapper = new QSignalMapper();
79     CONNECT( SDMapper, mapped (QString), this, SDMenuAction( QString ) );
80
81     DialogHandler *dialogHandler = new DialogHandler (p_intf, this );
82 }
83
84 DialogsProvider::~DialogsProvider()
85 {
86     PlaylistDialog::killInstance();
87     MediaInfoDialog::killInstance();
88     MessagesDialog::killInstance();
89     ExtendedDialog::killInstance();
90     BookmarksDialog::killInstance();
91     HelpDialog::killInstance();
92 #ifdef UPDATE_CHECK
93     UpdateDialog::killInstance();
94 #endif
95
96     delete menusMapper;
97     delete menusUpdateMapper;
98     delete SDMapper;
99 }
100
101 void DialogsProvider::quit()
102 {
103     b_isDying = true;
104     libvlc_Quit( p_intf->p_libvlc );
105 }
106
107 void DialogsProvider::customEvent( QEvent *event )
108 {
109     if( event->type() == (int)DialogEvent_Type )
110     {
111         DialogEvent *de = static_cast<DialogEvent*>(event);
112         switch( de->i_dialog )
113         {
114         case INTF_DIALOG_FILE_SIMPLE:
115         case INTF_DIALOG_FILE:
116             openDialog(); break;
117         case INTF_DIALOG_FILE_GENERIC:
118             openFileGenericDialog( de->p_arg ); break;
119         case INTF_DIALOG_DISC:
120             openDiscDialog(); break;
121         case INTF_DIALOG_NET:
122             openNetDialog(); break;
123         case INTF_DIALOG_SAT:
124         case INTF_DIALOG_CAPTURE:
125             openCaptureDialog(); break;
126         case INTF_DIALOG_DIRECTORY:
127             PLAppendDir(); break;
128         case INTF_DIALOG_PLAYLIST:
129             playlistDialog(); break;
130         case INTF_DIALOG_MESSAGES:
131             messagesDialog(); break;
132         case INTF_DIALOG_FILEINFO:
133            mediaInfoDialog(); break;
134         case INTF_DIALOG_PREFS:
135            prefsDialog(); break;
136         case INTF_DIALOG_BOOKMARKS:
137            bookmarksDialog(); break;
138         case INTF_DIALOG_EXTENDED:
139            extendedDialog(); break;
140 #ifdef ENABLE_VLM
141         case INTF_DIALOG_VLM:
142            vlmDialog(); break;
143 #endif
144         case INTF_DIALOG_POPUPMENU:
145            QVLCMenu::PopupMenu( p_intf, (de->i_arg != 0) ); break;
146         case INTF_DIALOG_AUDIOPOPUPMENU:
147            QVLCMenu::AudioPopupMenu( p_intf ); break;
148         case INTF_DIALOG_VIDEOPOPUPMENU:
149            QVLCMenu::VideoPopupMenu( p_intf ); break;
150         case INTF_DIALOG_MISCPOPUPMENU:
151            QVLCMenu::MiscPopupMenu( p_intf ); break;
152         case INTF_DIALOG_WIZARD:
153         case INTF_DIALOG_STREAMWIZARD:
154             openAndStreamingDialogs(); break;
155 #ifdef UPDATE_CHECK
156         case INTF_DIALOG_UPDATEVLC:
157             updateDialog(); break;
158 #endif
159         case INTF_DIALOG_EXIT:
160             quit(); break;
161         default:
162            msg_Warn( p_intf, "unimplemented dialog" );
163         }
164     }
165 }
166
167 /****************************************************************************
168  * Individual simple dialogs
169  ****************************************************************************/
170 void DialogsProvider::playlistDialog()
171 {
172     PlaylistDialog::getInstance( p_intf )->toggleVisible();
173 }
174
175 void DialogsProvider::prefsDialog()
176 {
177     PrefsDialog *p = new PrefsDialog( (QWidget *)p_intf->p_sys->p_mi, p_intf );
178     p->toggleVisible();
179 }
180
181 void DialogsProvider::extendedDialog()
182 {
183     if( !ExtendedDialog::getInstance( p_intf )->isVisible() || /* Hidden */
184         ExtendedDialog::getInstance( p_intf )->currentTab() != 0 )  /* wrong tab */
185         ExtendedDialog::getInstance( p_intf )->showTab( 0 );
186     else
187         ExtendedDialog::getInstance( p_intf )->hide();
188 }
189
190 void DialogsProvider::synchroDialog()
191 {
192     if( !ExtendedDialog::getInstance( p_intf )->isVisible() || /* Hidden */
193         ExtendedDialog::getInstance( p_intf )->currentTab() != 2 )  /* wrong tab */
194         ExtendedDialog::getInstance( p_intf )->showTab( 2 );
195     else
196         ExtendedDialog::getInstance( p_intf )->hide();
197 }
198
199 void DialogsProvider::messagesDialog()
200 {
201     MessagesDialog::getInstance( p_intf )->toggleVisible();
202 }
203
204 void DialogsProvider::gotoTimeDialog()
205 {
206     GotoTimeDialog::getInstance( p_intf )->toggleVisible();
207 }
208
209 #ifdef ENABLE_VLM
210 void DialogsProvider::vlmDialog()
211 {
212     VLMDialog::getInstance( p_intf )->toggleVisible();
213 }
214 #endif
215
216 void DialogsProvider::helpDialog()
217 {
218     HelpDialog::getInstance( p_intf )->toggleVisible();
219 }
220
221 #ifdef UPDATE_CHECK
222 void DialogsProvider::updateDialog()
223 {
224     UpdateDialog::getInstance( p_intf )->toggleVisible();
225 }
226 #endif
227
228 void DialogsProvider::aboutDialog()
229 {
230     AboutDialog::getInstance( p_intf )->toggleVisible();
231 }
232
233 void DialogsProvider::mediaInfoDialog()
234 {
235     MediaInfoDialog::getInstance( p_intf )->showTab( 0 );
236 }
237
238 void DialogsProvider::mediaCodecDialog()
239 {
240     MediaInfoDialog::getInstance( p_intf )->showTab( 2 );
241 }
242
243 void DialogsProvider::bookmarksDialog()
244 {
245     BookmarksDialog::getInstance( p_intf )->toggleVisible();
246 }
247
248 void DialogsProvider::podcastConfigureDialog()
249 {
250     PodcastConfigDialog::getInstance( p_intf )->toggleVisible();
251 }
252
253 void DialogsProvider::toolbarDialog()
254 {
255     ToolbarEditDialog *toolbarEditor = new ToolbarEditDialog( (QWidget *)p_intf->p_sys->p_mi, p_intf );
256     if( toolbarEditor->exec() == QDialog::Accepted )
257         emit toolBarConfUpdated();
258 }
259
260 void DialogsProvider::pluginDialog()
261 {
262     PluginDialog *diag = new PluginDialog( p_intf );
263     diag->show();
264 }
265
266 /* Generic open file */
267 void DialogsProvider::openFileGenericDialog( intf_dialog_args_t *p_arg )
268 {
269     if( p_arg == NULL )
270     {
271         msg_Warn( p_intf, "openFileGenericDialog() called with NULL arg" );
272         return;
273     }
274
275     /* Replace the extensions to a Qt format */
276     int i = 0;
277     QString extensions = qfu( p_arg->psz_extensions );
278     while ( ( i = extensions.indexOf( "|", i ) ) != -1 )
279     {
280         if( ( extensions.count( "|" ) % 2 ) == 0 )
281             extensions.replace( i, 1, ");;" );
282         else
283             extensions.replace( i, 1, "(" );
284     }
285     extensions.replace( ";*", " *" );
286     extensions.append( ")" );
287
288     /* Save */
289     if( p_arg->b_save )
290     {
291         QString file = QFileDialog::getSaveFileName( NULL, p_arg->psz_title,
292                                         p_intf->p_sys->filepath, extensions );
293         if( !file.isEmpty() )
294         {
295             p_arg->i_results = 1;
296             p_arg->psz_results = (char **)malloc( p_arg->i_results * sizeof( char * ) );
297             p_arg->psz_results[0] = strdup( qtu( toNativeSepNoSlash( file ) ) );
298         }
299         else
300             p_arg->i_results = 0;
301     }
302     else /* non-save mode */
303     {
304         QStringList files = QFileDialog::getOpenFileNames( NULL,
305                 p_arg->psz_title, p_intf->p_sys->filepath,
306                 extensions );
307         p_arg->i_results = files.count();
308         p_arg->psz_results = (char **)malloc( p_arg->i_results * sizeof( char * ) );
309         i = 0;
310         foreach( const QString &file, files )
311             p_arg->psz_results[i++] = strdup( qtu( toNativeSepNoSlash( file ) ) );
312         p_intf->p_sys->filepath = qfu( p_arg->psz_results[i] );
313     }
314
315     /* Callback */
316     if( p_arg->pf_callback )
317         p_arg->pf_callback( p_arg );
318
319     /* Clean afterwards */
320     if( p_arg->psz_results )
321     {
322         for( i = 0; i < p_arg->i_results; i++ )
323             free( p_arg->psz_results[i] );
324         free( p_arg->psz_results );
325     }
326     free( p_arg->psz_title );
327     free( p_arg->psz_extensions );
328     free( p_arg );
329 }
330 /****************************************************************************
331  * All the open/add stuff
332  * Open Dialog first - Simple Open then
333  ****************************************************************************/
334
335 void DialogsProvider::openDialog( int i_tab )
336 {
337     OpenDialog::getInstance( p_intf->p_sys->p_mi , p_intf )->showTab( i_tab );
338 }
339 void DialogsProvider::openDialog()
340 {
341     openDialog( OPEN_FILE_TAB );
342 }
343 void DialogsProvider::openFileDialog()
344 {
345     openDialog( OPEN_FILE_TAB );
346 }
347 void DialogsProvider::openDiscDialog()
348 {
349     openDialog( OPEN_DISC_TAB );
350 }
351 void DialogsProvider::openNetDialog()
352 {
353     openDialog( OPEN_NETWORK_TAB );
354 }
355 void DialogsProvider::openCaptureDialog()
356 {
357     openDialog( OPEN_CAPTURE_TAB );
358 }
359
360 /* Same as the open one, but force the enqueue */
361 void DialogsProvider::PLAppendDialog( int tab )
362 {
363     OpenDialog::getInstance( p_intf->p_sys->p_mi, p_intf, false,
364                              OPEN_AND_ENQUEUE )->showTab( tab );
365 }
366
367 void DialogsProvider::MLAppendDialog( int tab )
368 {
369     OpenDialog::getInstance( p_intf->p_sys->p_mi, p_intf, false,
370                             OPEN_AND_ENQUEUE, false, false )
371                                     ->showTab( tab );
372 }
373
374 /**
375  * Simple open
376  ***/
377 QStringList DialogsProvider::showSimpleOpen( QString help,
378                                              int filters,
379                                              QString path )
380 {
381     QString fileTypes = "";
382     if( filters & EXT_FILTER_MEDIA ) {
383         ADD_FILTER_MEDIA( fileTypes );
384     }
385     if( filters & EXT_FILTER_VIDEO ) {
386         ADD_FILTER_VIDEO( fileTypes );
387     }
388     if( filters & EXT_FILTER_AUDIO ) {
389         ADD_FILTER_AUDIO( fileTypes );
390     }
391     if( filters & EXT_FILTER_PLAYLIST ) {
392         ADD_FILTER_PLAYLIST( fileTypes );
393     }
394     if( filters & EXT_FILTER_SUBTITLE ) {
395         ADD_FILTER_SUBTITLE( fileTypes );
396     }
397     ADD_FILTER_ALL( fileTypes );
398     fileTypes.replace( ";*", " *");
399
400     QStringList files = QFileDialog::getOpenFileNames( NULL,
401         help.isEmpty() ? qtr(I_OP_SEL_FILES ) : help,
402         path.isEmpty() ? p_intf->p_sys->filepath : path,
403         fileTypes );
404
405     if( !files.isEmpty() ) savedirpathFromFile( files.last() );
406
407     return files;
408 }
409
410 /**
411  * Open a file,
412  * pl helps you to choose from playlist or media library,
413  * go to start or enqueue
414  **/
415 void DialogsProvider::addFromSimple( bool pl, bool go)
416 {
417     QStringList files = DialogsProvider::showSimpleOpen();
418     int i = 0;
419     files.sort();
420     foreach( const QString &file, files )
421     {
422         playlist_Add( THEPL, qtu( toNativeSeparators( file ) ), NULL,
423                       go ? ( PLAYLIST_APPEND | ( i ? 0 : PLAYLIST_GO ) |
424                                                ( i ? PLAYLIST_PREPARSE : 0 ) )
425                          : ( PLAYLIST_APPEND | PLAYLIST_PREPARSE ),
426                       PLAYLIST_END,
427                       pl ? true : false, false );
428         RecentsMRL::getInstance( p_intf )->addRecent(
429                 toNativeSeparators( file ) );
430         i++;
431     }
432 }
433
434 void DialogsProvider::simpleOpenDialog()
435 {
436     addFromSimple( true, true ); /* Playlist and Go */
437 }
438
439 void DialogsProvider::simplePLAppendDialog()
440 {
441     addFromSimple( true, false );
442 }
443
444 void DialogsProvider::simpleMLAppendDialog()
445 {
446     addFromSimple( false, false );
447 }
448
449 /* Url & Clipboard */
450 /**
451  * Open a MRL.
452  * If the clipboard contains URLs, the first is automatically 'preselected'.
453  **/
454 void DialogsProvider::openUrlDialog()
455 {
456     OpenUrlDialog *oud = OpenUrlDialog::getInstance( p_intf->p_sys->p_mi,
457                                                      p_intf );
458     if( oud->exec() == QDialog::Accepted )
459     {
460         QString url = oud->url();
461         if( !url.isEmpty() )
462         {
463             playlist_Add( THEPL, qtu( url ),
464                           NULL, !oud->shouldEnqueue() ?
465                                   ( PLAYLIST_APPEND | PLAYLIST_GO )
466                                 : ( PLAYLIST_APPEND | PLAYLIST_PREPARSE ),
467                           PLAYLIST_END, true, false );
468             RecentsMRL::getInstance( p_intf )->addRecent( url );
469         }
470     }
471 }
472
473 /* Directory */
474 /**
475  * Open a directory,
476  * pl helps you to choose from playlist or media library,
477  * go to start or enqueue
478  **/
479 static void openDirectory( intf_thread_t *p_intf, bool pl, bool go )
480 {
481     QString dir = QFileDialog::getExistingDirectory( NULL, qtr("Open Directory"), p_intf->p_sys->filepath );
482
483     if (!dir.isEmpty() )
484     {
485         QString mrl = dir.endsWith( "VIDEO_TS", Qt::CaseInsensitive ) ?
486             "dvd://" : "directory://" + toNativeSeparators( dir );
487         input_item_t *p_input = input_item_New( THEPL, qtu( mrl ), NULL );
488
489         /* FIXME: playlist_AddInput() can fail */
490         playlist_AddInput( THEPL, p_input,
491                        go ? ( PLAYLIST_APPEND | PLAYLIST_GO ) : PLAYLIST_APPEND,
492                        PLAYLIST_END, pl, pl_Unlocked );
493         RecentsMRL::getInstance( p_intf )->addRecent( mrl );
494         if( !go )
495             input_Read( THEPL, p_input, true );
496         vlc_gc_decref( p_input );
497     }
498 }
499
500 void DialogsProvider::PLOpenDir()
501 {
502     openDirectory( p_intf, true, true );
503 }
504
505 void DialogsProvider::PLAppendDir()
506 {
507     openDirectory( p_intf, true, false );
508 }
509
510 void DialogsProvider::MLAppendDir()
511 {
512     openDirectory( p_intf, false , false );
513 }
514
515 /****************
516  * Playlist     *
517  ****************/
518 void DialogsProvider::openAPlaylist()
519 {
520     QStringList files = showSimpleOpen( qtr( "Open playlist..." ),
521                                         EXT_FILTER_PLAYLIST );
522     foreach( const QString &file, files )
523     {
524         playlist_Import( THEPL, qtu( toNativeSeparators( file ) ) );
525     }
526 }
527
528 void DialogsProvider::saveAPlaylist()
529 {
530     QString file = QFileDialog::getSaveFileName( NULL,
531                                   qtr( "Save playlist as..." ),
532                                   p_intf->p_sys->filepath,
533                                   qtr( "XSPF playlist (*.xspf);; " ) +
534                                   qtr( "M3U playlist (*.m3u);; " ) +
535                                   qtr( "HTML playlist (*.html)" ) );
536
537     if( !file.isEmpty() )
538     {
539         static const char psz_xspf[] = "export-xspf",
540                           psz_m3u[] = "export-m3u",
541                           psz_html[] = "export-html";
542         const char *psz_module;
543
544         if( file.contains( ".xsp" ) )
545             psz_module = psz_xspf;
546         else if( file.contains( ".m3u" ) )
547             psz_module = psz_m3u;
548         else if( file.contains(".html" ) )
549             psz_module = psz_html;
550         else
551         {
552             msg_Warn( p_intf, "Impossible to recognise the file type. "
553                     "Defaulting to XSPF" );
554             psz_module = psz_xspf;
555             file.append( ".xpsf" );
556         }
557
558         playlist_Export( THEPL, qtu( toNativeSeparators( file ) ),
559                 THEPL->p_local_category, psz_module);
560     }
561 }
562
563 /****************************************************************************
564  * Sout emulation
565  ****************************************************************************/
566
567 void DialogsProvider::streamingDialog( QWidget *parent,
568                                        QString mrl,
569                                        bool b_transcode_only,
570                                        QStringList options )
571 {
572     char *psz_soutoption;
573
574     /* Stream */
575     if( !b_transcode_only )
576     {
577         SoutDialog *s = new SoutDialog( parent, p_intf, mrl );
578         if( s->exec() == QDialog::Accepted )
579         {
580             psz_soutoption = strdup( qtu( s->getMrl() ) );
581             delete s;
582         }
583         else
584         {
585             delete s; return;
586         }
587     } else {
588     /* Convert */
589         ConvertDialog *s = new ConvertDialog( parent, p_intf, mrl );
590         if( s->exec() == QDialog::Accepted )
591         {
592             psz_soutoption = strdup( qtu( s->getMrl() ) );
593             delete s;
594         }
595         else
596         {
597             delete s; return;
598         }
599     }
600
601     /* Get SoutMRL */
602     if( !EMPTY_STR( psz_soutoption ) )
603     {
604         options += QString( psz_soutoption ).split( " :");
605
606         /* Create Input */
607         input_item_t *p_input;
608         p_input = input_item_New( p_intf, qtu( mrl ), _("Streaming") );
609
610         /* Add normal Options */
611         for( int j = 0; j < options.size(); j++ )
612         {
613             QString qs = colon_unescape( options[j] );
614             if( !qs.isEmpty() )
615             {
616                 input_item_AddOption( p_input, qtu( qs ),
617                         VLC_INPUT_OPTION_TRUSTED );
618                 msg_Dbg( p_intf, "Adding option: %s", qtu( qs ) );
619             }
620         }
621
622         /* Switch between enqueuing and starting the item */
623         /* FIXME: playlist_AddInput() can fail */
624         playlist_AddInput( THEPL, p_input,
625                 PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END, true, pl_Unlocked );
626         vlc_gc_decref( p_input );
627
628         RecentsMRL::getInstance( p_intf )->addRecent( mrl );
629     }
630     free( psz_soutoption );
631 }
632
633 void DialogsProvider::openAndStreamingDialogs()
634 {
635     OpenDialog::getInstance( p_intf->p_sys->p_mi, p_intf, false, OPEN_AND_STREAM )
636                                 ->showTab( OPEN_FILE_TAB );
637 }
638
639 void DialogsProvider::openAndTranscodingDialogs()
640 {
641     OpenDialog::getInstance( p_intf->p_sys->p_mi , p_intf, false, OPEN_AND_SAVE )
642                                 ->showTab( OPEN_FILE_TAB );
643 }
644
645 void DialogsProvider::loadSubtitlesFile()
646 {
647     input_thread_t *p_input = THEMIM->getInput();
648     if( !p_input ) return;
649
650     input_item_t *p_item = input_GetItem( p_input );
651     if( !p_item ) return;
652
653     char *path = input_item_GetURI( p_item );
654     if( !path ) path = strdup( "" );
655
656     char *sep = strrchr( path, DIR_SEP_CHAR );
657     if( sep ) *sep = '\0';
658
659     QStringList qsl = showSimpleOpen( qtr( "Open subtitles..." ),
660                                       EXT_FILTER_SUBTITLE,
661                                       path );
662     free( path );
663     foreach( const QString &qsFile, qsl )
664     {
665         if( input_AddSubtitle( p_input, qtu( toNativeSeparators( qsFile ) ),
666                     true ) )
667             msg_Warn( p_intf, "unable to load subtitles from '%s'",
668                       qtu( qsFile ) );
669     }
670 }
671
672
673 /****************************************************************************
674  * Menus
675  ****************************************************************************/
676
677 void DialogsProvider::menuAction( QObject *data )
678 {
679     QVLCMenu::DoAction( data );
680 }
681
682 void DialogsProvider::menuUpdateAction( QObject *data )
683 {
684     MenuFunc *func = qobject_cast<MenuFunc *>(data);
685     assert( func );
686     func->doFunc( p_intf );
687 }
688
689 void DialogsProvider::SDMenuAction( QString data )
690 {
691     char *psz_sd = strdup( qtu( data ) );
692     if( !playlist_IsServicesDiscoveryLoaded( THEPL, psz_sd ) )
693         playlist_ServicesDiscoveryAdd( THEPL, psz_sd );
694     else
695         playlist_ServicesDiscoveryRemove( THEPL, psz_sd );
696     free( psz_sd );
697 }
698
699 /**
700  * Play the MRL contained in the Recently played menu.
701  **/
702 void DialogsProvider::playMRL( const QString &mrl )
703 {
704     playlist_Add( THEPL, qtu( mrl ) , NULL,
705            PLAYLIST_APPEND | PLAYLIST_GO , PLAYLIST_END, true, false );
706
707     RecentsMRL::getInstance( p_intf )->addRecent( mrl );
708 }