mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-11 16:44:05 +02:00
* Allow empty titled XSPFs to be imported if they contain tracks at least.
This commit is contained in:
@@ -76,17 +76,14 @@ XSPFLoader::gotBody()
|
||||
xmldoc.setContent( m_body );
|
||||
QDomElement docElement( xmldoc.documentElement() );
|
||||
|
||||
QString title, info, creator;
|
||||
title = docElement.firstChildElement( "title" ).text();
|
||||
QString origTitle, title, info, creator;
|
||||
origTitle = docElement.firstChildElement( "title" ).text();
|
||||
info = docElement.firstChildElement( "creator" ).text();
|
||||
creator = docElement.firstChildElement( "info" ).text();
|
||||
|
||||
title = origTitle;
|
||||
if ( title.isEmpty() )
|
||||
{
|
||||
QMessageBox::critical( APP->mainWindow(), tr( "XSPF Error" ), tr( "This is not a valid XSPF playlist." ) );
|
||||
deleteLater();
|
||||
return;
|
||||
}
|
||||
title = tr( "New Playlist" );
|
||||
|
||||
m_playlist = Playlist::create( APP->sourcelist().getLocal(),
|
||||
uuid(),
|
||||
@@ -118,6 +115,13 @@ XSPFLoader::gotBody()
|
||||
entries << p;
|
||||
}
|
||||
|
||||
if ( origTitle.isEmpty() && entries.isEmpty() )
|
||||
{
|
||||
QMessageBox::critical( APP->mainWindow(), tr( "XSPF Error" ), tr( "This is not a valid XSPF playlist." ) );
|
||||
deleteLater();
|
||||
return;
|
||||
}
|
||||
|
||||
m_playlist->createNewRevision( uuid(), m_playlist->currentrevision(), entries );
|
||||
emit ok( m_playlist );
|
||||
|
||||
|
Reference in New Issue
Block a user