[Amarok] 4047c4a The point of these confirmation dialogs is to show

Casey Link unnamedrambler at gmail.com
Fri Mar 26 21:51:04 CET 2010


commit 4047c4a484e921a17f219197dadc2e938fad67fe
Author: Casey Link <unnamedrambler at gmail.com>
Date:   Fri Mar 26 16:56:34 2010 -0400

    The point of these confirmation dialogs is to show the user _exactly_
    what operation is about to be performed. Merely showing the Artist+Title
    is not near enough information.
    
    Undo Mark's change and use prettyUrl() for user presentation, this is
    after all what it is for. This means collections need to correctly
    implement prettyUrl() if their playableUrl() does not suffice.
    
    I took the initiative to edit the MediaDevice implementation,
    but I cannot test it.
    
    CCMAIL:kretschmann at kde.org
    CCMAIL:amarok-devel at kde.org

diff --git a/src/collection/CollectionLocationDelegateImpl.cpp b/src/collection/CollectionLocationDelegateImpl.cpp
index 86de9c0..f06a1f4 100644
--- a/src/collection/CollectionLocationDelegateImpl.cpp
+++ b/src/collection/CollectionLocationDelegateImpl.cpp
@@ -29,7 +29,7 @@ CollectionLocationDelegateImpl::reallyDelete( CollectionLocation *loc, const Met
 
     QStringList files;
     foreach( Meta::TrackPtr track, tracks )
-        files << realTrackName( track );
+        files << track->prettyUrl();
 
     // NOTE: taken from SqlCollection
     // TODO put the delete confirmation code somewhere else?
@@ -49,7 +49,7 @@ bool CollectionLocationDelegateImpl::reallyMove(CollectionLocation* loc, const M
     Q_UNUSED( loc )
     QStringList files;
     foreach( Meta::TrackPtr track, tracks )
-        files << realTrackName( track );
+        files << track->prettyUrl();
     
     const QString text( i18ncp( "@info", "Do you really want to move this track? It will be renamed and the original deleted.",
                                 "Do you really want to move these %1 tracks? They will be renamed and the originals deleted", tracks.count() ) );
@@ -65,7 +65,7 @@ void CollectionLocationDelegateImpl::errorDeleting( CollectionLocation* loc, con
     Q_UNUSED( loc );
     QStringList files;
     foreach( Meta::TrackPtr track, tracks )
-        files << realTrackName( track );
+        files << track->prettyUrl();
 
     const QString text( i18ncp( "@info", "There was a problem and this track could not be removed. Make sure the directory is writeable.",
                                 "There was a problem and %1 tracks could not be removed. Make sure the directory is writeable.", files.count() ) );
@@ -80,21 +80,3 @@ void CollectionLocationDelegateImpl::notWriteable(CollectionLocation* loc) const
     Q_UNUSED( loc )
     The::statusBar()->longMessage( i18n( "The collection does not have enough free space available or is not writeable." ), StatusBar::Error );
 }
-
-
-///////////////////////////////////////////////////
-// PRIVATE
-///////////////////////////////////////////////////
-
-QString CollectionLocationDelegateImpl::realTrackName( const Meta::TrackPtr track ) const
-{
-    QString name;
-
-    if( track->artist() )
-        name = track->artist()->prettyName() + " - " + track->prettyName();
-    else
-        name = track->prettyName();
-
-   return name;
-}
-
diff --git a/src/collection/CollectionLocationDelegateImpl.h b/src/collection/CollectionLocationDelegateImpl.h
index 92420a5..e226fdc 100644
--- a/src/collection/CollectionLocationDelegateImpl.h
+++ b/src/collection/CollectionLocationDelegateImpl.h
@@ -31,15 +31,6 @@ public:
     virtual bool reallyMove(CollectionLocation* loc, const Meta::TrackList& tracks) const;
     virtual void errorDeleting( CollectionLocation* loc, const Meta::TrackList& tracks ) const;
     virtual void notWriteable(CollectionLocation* loc) const;
-
- private:
-    /**
-     * Builds a string of the format "ARTIST - TITLE",
-     * for media device tracks.
-     * @param track Pointer of the Meta::Track item
-     * @return String with artist and title
-     */
-    virtual QString realTrackName( const Meta::TrackPtr track ) const;
 };
 
 
diff --git a/src/collection/mediadevicecollection/MediaDeviceMeta.cpp b/src/collection/mediadevicecollection/MediaDeviceMeta.cpp
index 7e83ecb..460348f 100644
--- a/src/collection/mediadevicecollection/MediaDeviceMeta.cpp
+++ b/src/collection/mediadevicecollection/MediaDeviceMeta.cpp
@@ -143,7 +143,7 @@ MediaDeviceTrack::uidUrl() const
 QString
 MediaDeviceTrack::prettyUrl() const
 {
-    return m_playableUrl.isLocalFile() ? m_playableUrl.toLocalFile() : m_playableUrl.url();
+    return m_playableUrl.isLocalFile() ? m_playableUrl.toLocalFile() : QString( collection()->prettyName() + ": " + artist()->prettyName() + " - " + prettyName() );
 }
 
 bool


More information about the Amarok-devel mailing list