Commit cb78122a authored by Matěj Laitl's avatar Matěj Laitl
Browse files

Allow saving of file playlists with a dot in name

BUGFIXES:
 * Playlists with a dot in name can now be saved to Playlist Files on Disk.

BUG: 290318
FIXED-IN: 2.6
parent 3a9b36fe
......@@ -42,6 +42,7 @@ Version 2.6-Beta 1
"1.2 GB free" is shown instead of "85% used"; thicker capacity bar.
BUGFIXES:
* Playlists with a dot in name can now be saved to Playlist Files on Disk. (BR 290318)
* iPod playlists now appear even when plugged in while Amarok is running. (BR 289303)
* Show in Media Sources actions no longer reset the collection sorting to artist/album. (BR 231858)
* Don't mark audio-CD tracks as unplayable (greyed out). (BR 285885)
......
......@@ -50,7 +50,6 @@ namespace Playlists {
PlaylistFileProvider::PlaylistFileProvider()
: UserPlaylistProvider()
, m_playlistsLoaded( false )
, m_defaultFormat( Playlists::XSPF )
, m_renameAction( 0 )
, m_deleteAction( 0 )
, m_removeTrackAction( 0 )
......@@ -233,7 +232,15 @@ PlaylistFileProvider::save( const Meta::TrackList &tracks, const QString &name )
{
DEBUG_BLOCK
QString filename = name.isEmpty() ? QDateTime::currentDateTime().toString( "ddd MMMM d yy hh-mm") : name;
filename = QString( filename ).replace( QLatin1Char('/'), QLatin1Char('-') );
filename.replace( QLatin1Char('/'), QLatin1Char('-') );
QString ext = Amarok::extension( filename );
Playlists::PlaylistFormat format = Playlists::getFormat( ext );
if( format == Unknown )
{
format = Playlists::XSPF;
filename.append( QLatin1String( ".xspf" ) );
}
KUrl path( Amarok::saveLocation( "playlists" ) );
path.addPath( Amarok::vfatPath( filename ) );
......@@ -243,19 +250,6 @@ PlaylistFileProvider::save( const Meta::TrackList &tracks, const QString &name )
return Playlists::PlaylistPtr();
}
//FIXME: extention guessing fails with playlist names with a '.' in them
Playlists::PlaylistFormat format = m_defaultFormat;
QString ext = Amarok::extension( path.fileName() );
if( ext.isEmpty() )
{
ext = QLatin1String("xspf");
path.setFileName( QString("%1.%2").arg(Amarok::vfatPath(filename), ext) );
}
else
{
format = Playlists::getFormat( path );
}
Playlists::PlaylistFile *playlistFile = 0;
switch( format )
{
......@@ -273,7 +267,6 @@ PlaylistFileProvider::save( const Meta::TrackList &tracks, const QString &name )
return Playlists::PlaylistPtr();
}
playlistFile->setName( filename );
debug() << "Forcing save of playlist!";
playlistFile->save( path, true );
playlistFile->setProvider( this );
......
......@@ -84,7 +84,6 @@ class PlaylistFileProvider : public Playlists::UserPlaylistProvider
bool m_playlistsLoaded;
QList<KUrl> m_urlsToLoad;
Playlists::PlaylistFileList m_playlists;
Playlists::PlaylistFormat m_defaultFormat;
QMultiMap<QString, Playlists::PlaylistPtr> m_groupMap;
QAction *m_renameAction;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment