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 );
|
xmldoc.setContent( m_body );
|
||||||
QDomElement docElement( xmldoc.documentElement() );
|
QDomElement docElement( xmldoc.documentElement() );
|
||||||
|
|
||||||
QString title, info, creator;
|
QString origTitle, title, info, creator;
|
||||||
title = docElement.firstChildElement( "title" ).text();
|
origTitle = docElement.firstChildElement( "title" ).text();
|
||||||
info = docElement.firstChildElement( "creator" ).text();
|
info = docElement.firstChildElement( "creator" ).text();
|
||||||
creator = docElement.firstChildElement( "info" ).text();
|
creator = docElement.firstChildElement( "info" ).text();
|
||||||
|
|
||||||
|
title = origTitle;
|
||||||
if ( title.isEmpty() )
|
if ( title.isEmpty() )
|
||||||
{
|
title = tr( "New Playlist" );
|
||||||
QMessageBox::critical( APP->mainWindow(), tr( "XSPF Error" ), tr( "This is not a valid XSPF playlist." ) );
|
|
||||||
deleteLater();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_playlist = Playlist::create( APP->sourcelist().getLocal(),
|
m_playlist = Playlist::create( APP->sourcelist().getLocal(),
|
||||||
uuid(),
|
uuid(),
|
||||||
@@ -118,6 +115,13 @@ XSPFLoader::gotBody()
|
|||||||
entries << p;
|
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 );
|
m_playlist->createNewRevision( uuid(), m_playlist->currentrevision(), entries );
|
||||||
emit ok( m_playlist );
|
emit ok( m_playlist );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user