1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-11 08:34:34 +02:00

* Allow empty titled XSPFs to be imported if they contain tracks at least.

This commit is contained in:
Christian Muehlhaeuser
2010-12-07 14:49:29 +01:00
parent e4f9e936ed
commit 7aaf3eb98c

View File

@@ -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 );