[Amarok] Fix regression for exclusive users of QDesktopServ

Maximilian Kossick maximilian.kossick at googlemail.com
Sat Jan 16 10:22:52 CET 2010


It's still broken. Use MusicLocation is not actually written to amarokrc.


On Fri, Jan 15, 2010 at 11:03 PM, Rick W. Chen <stuffcorpse at archlinux.us> wrote:
> commit 7a5449127bfc0f8c47d8e3dae038bad7b4957af0
> Author:     Rick W. Chen <stuffcorpse at archlinux.us>
> AuthorDate: Sat Jan 16 10:58:38 2010 +1300
> Commit:     Rick W. Chen <stuffcorpse at archlinux.us>
> CommitDate: Sat Jan 16 10:58:38 2010 +1300
>
>    Fix regression for exclusive users of QDesktopServices::MusicLocation
>
>    "the commit e969888134b686 breaks if an existing amarok user never used
>    anything but the MusicLocation" -- maxx_k.
>
> diff --git a/src/App.cpp b/src/App.cpp
> index fb1e0ff..586d80f 100644
> --- a/src/App.cpp
> +++ b/src/App.cpp
> @@ -793,11 +793,14 @@ App::continueInit()
>                     );
>             }
>
> +            KConfigGroup folderConf = Amarok::config( "Collection Folders" );
> +            bool useMusicLocation( false );
>             switch( result )
>             {
>             case KMessageBox::Yes:
>                 MountPointManager::instance()->setCollectionFolders( QStringList() << musicDir );
>                 CollectionManager::instance()->startFullScan();
> +                useMusicLocation = true;
>                 break;
>
>             case KMessageBox::No:
> @@ -807,6 +810,7 @@ App::continueInit()
>             default:
>                 break;
>             }
> +            folderConf.writeEntry( "Use MusicLocation", useMusicLocation );
>             config.writeEntry( "First Run", false );
>         }
>     }
> diff --git a/src/MountPointManager.cpp b/src/MountPointManager.cpp
> index 021d178..b46539d 100644
> --- a/src/MountPointManager.cpp
> +++ b/src/MountPointManager.cpp
> @@ -365,6 +365,20 @@ MountPointManager::collectionFolders()
>                 result.append( absPath );
>         }
>     }
> +
> +    // For users who were using QDesktopServices::MusicLocation exclusively up
> +    // to v2.2.2, which did not store the location into config.
> +    if( result.isEmpty() && folders.readEntry( "Use MusicLocation", false )  )
> +    {
> +        const KUrl musicUrl = QDesktopServices::storageLocation( QDesktopServices::MusicLocation );
> +        const QString musicDir = musicUrl.toLocalFile( KUrl::RemoveTrailingSlash );
> +        const QDir dir( musicDir );
> +        if( dir.exists() && dir.isReadable() )
> +        {
> +            result << musicDir;
> +            setCollectionFolders( result );
> +        }
> +    }
>     return result;
>  }
>
>
>
>


More information about the Amarok-devel mailing list