From 7aaf3eb98cd181c65ee170ed0f903f1bf570f922 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Tue, 7 Dec 2010 14:49:29 +0100 Subject: [PATCH] * Allow empty titled XSPFs to be imported if they contain tracks at least. --- src/xspfloader.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/xspfloader.cpp b/src/xspfloader.cpp index 399c56829..d2ef1a8ea 100644 --- a/src/xspfloader.cpp +++ b/src/xspfloader.cpp @@ -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 );