#include "recents.hpp"
#include "dialogs_provider.hpp"
+#include "menus.hpp"
#include <QList>
#include <QString>
isActive = config_GetInt( p_intf, "qt-recentplay" );
char* psz_tmp = config_GetPsz( p_intf, "qt-recentplay-filter" );
- filter = new QRegExp( psz_tmp, Qt::CaseInsensitive );
+ if( psz_tmp && *psz_tmp )
+ filter = new QRegExp( psz_tmp, Qt::CaseInsensitive );
+ else
+ filter = NULL;
free( psz_tmp );
load();
- if ( !isActive ) clear();
+ if( !isActive ) clear();
}
RecentsMRL::~RecentsMRL()
void RecentsMRL::addRecent( const QString &mrl )
{
- if ( !isActive || filter->indexIn( mrl ) >= 0 )
+ if ( !isActive || ( filter && filter->indexIn( mrl ) >= 0 ) )
return;
msg_Dbg( p_intf, "Adding a new MRL to recent ones: %s", qtu( mrl ) );
if( stack->size() > RECENTS_LIST_SIZE )
stack->takeLast();
}
- emit updated();
+ QVLCMenu::updateRecents( p_intf );
save();
}
if ( stack->isEmpty() )
return;
stack->clear();
- emit updated();
+ if( isActive ) QVLCMenu::updateRecents( p_intf );
save();
}
for( int i = 0; i < list.size(); ++i )
{
- if (filter->indexIn( list.at(i) ) == -1)
+ if ( !filter || filter->indexIn( list.at(i) ) == -1 )
stack->append( list.at(i) );
}
}