[Pkg-kde-commits] rev 450 - people/dato/packages/trunk/amarok/debian/patches
Adeodato Simó
dato-guest@costa.debian.org
Wed, 02 Feb 2005 13:22:36 +0100
Author: dato-guest
Date: 2005-02-02 13:22:36 +0100 (Wed, 02 Feb 2005)
New Revision: 450
Added:
people/dato/packages/trunk/amarok/debian/patches/fix-loadM3U.patch
Log:
- small patch for annoying bug.
Added: people/dato/packages/trunk/amarok/debian/patches/fix-loadM3U.patch
===================================================================
--- people/dato/packages/trunk/amarok/debian/patches/fix-loadM3U.patch 2005-02-02 10:40:33 UTC (rev 449)
+++ people/dato/packages/trunk/amarok/debian/patches/fix-loadM3U.patch 2005-02-02 12:22:36 UTC (rev 450)
@@ -0,0 +1,107 @@
+Index: playlistloader.cpp
+===================================================================
+RCS file: /home/kde/kdeextragear-1/amarok/src/playlistloader.cpp,v
+retrieving revision 1.140
+retrieving revision 1.148
+diff -u -p -r1.140 -r1.148
+--- a/amarok/src/playlistloader.cpp 30 Jan 2005 23:04:20 -0000 1.140
++++ b/amarok/src/playlistloader.cpp 2 Feb 2005 12:13:16 -0000 1.148
+@@ -80,10 +80,9 @@ PlaylistLoader::PlaylistLoader( const KU
+ m_URLs += url;
+ }
+ }
+- else if( KFileItem( KFileItem::Unknown, KFileItem::Unknown, url ).isDir() )
++ else if( !url.isLocalFile() || QFileInfo( url.path() ).isDir() )
+ // we must check if it's a directory before we call recurse() on it
+ m_URLs += recurse( url );
+-
+ else
+ m_URLs += url;
+ }
+@@ -301,7 +300,7 @@ PlaylistFile::PlaylistFile( const QStrin
+ {
+ QFile file( path );
+ if( !file.open( IO_ReadOnly ) ) {
+- m_error = i18n( "amaroK couldn't open the file." );
++ m_error = i18n( "amaroK could not open the file." );
+ return;
+ }
+
+@@ -311,7 +310,7 @@ PlaylistFile::PlaylistFile( const QStrin
+ case M3U: loadM3u( stream ); break;
+ case PLS: loadPls( stream ); break;
+ case XML:
+- m_error = i18n( "This componenet of amaroK cannot translate XML playlists." );
++ m_error = i18n( "This component of amaroK cannot translate XML playlists." );
+ return;
+ default:
+ m_error = i18n( "amaroK does not support this playlist format." );
+@@ -319,7 +318,7 @@ PlaylistFile::PlaylistFile( const QStrin
+ }
+
+ if( m_error.isEmpty() && m_bundles.isEmpty() )
+- m_error = i18n( "The playlist didn't contain any references to files." );
++ m_error = i18n( "The playlist did not contain any references to files." );
+ }
+
+ bool
+@@ -328,9 +327,9 @@ PlaylistFile::loadM3u( QTextStream &stre
+ const QString directory = m_path.left( m_path.findRev( '/' ) + 1 );
+ MetaBundle b;
+
+- for( QString line; !stream.atEnd(); line = stream.readLine() )
++ for( QString line; !stream.atEnd(); )
+ {
+- if( line.isEmpty() ) continue;
++ line = stream.readLine();
+
+ if( line.startsWith( "#EXTINF" ) ) {
+ const QString extinf = line.section( ':', 1 );
+@@ -339,8 +338,14 @@ PlaylistFile::loadM3u( QTextStream &stre
+ b.setLength( length <= 0 ? /*MetaBundle::Undetermined HACK*/ -2 : length );
+ }
+
+- else if( !line.startsWith( "#" ) ) {
+- if( KURL::isRelativeURL( line ) )
++ else if( !line.startsWith( "#" ) && !line.isEmpty() )
++ {
++ // KURL::isRelativeURL() expects a protocol, so prepend it if missing
++ QString url = line;
++ if( url.startsWith( "/" ) )
++ url.prepend( "file://" );
++
++ if( KURL::isRelativeURL( url ) )
+ b.setPath( directory + line );
+ else
+ b.setUrl( KURL::fromPathOrURL( line ) );
+@@ -356,8 +361,10 @@ PlaylistFile::loadM3u( QTextStream &stre
+ bool
+ PlaylistFile::loadPls( QTextStream &stream )
+ {
+- for( QString line; !stream.atEnd(); line = stream.readLine() )
++ for( QString line; !stream.atEnd(); )
+ {
++ line = stream.readLine();
++
+ if( line.startsWith( "File" ) ) {
+ MetaBundle b;
+
+@@ -440,14 +447,16 @@ SqlLoader::SqlLoader( const QString &sql
+ bool
+ SqlLoader::doJob()
+ {
++ DEBUG_BLOCK
++
+ BundleList bundles;
+ QStringList values = CollectionDB::instance()->query( m_sql );
+
+ setProgressTotalSteps( values.count() );
+
+ uint x = 0;
+- foreach( values ) {
+- setProgress( x * 11 );
++ for( for_iterators( QStringList, values ); it != end || isAborted(); ++it ) {
++ setProgress( ++x * 11 );
+
+ MetaBundle b;
+ b.setAlbum ( *it );