Summary: | "playlist", "navigate" and "play" are not translatable | ||
---|---|---|---|
Product: | [Applications] amarok | Reporter: | Alexander Potashev <aspotashev> |
Component: | Tools/Bookmark Manager | Assignee: | Amarok Developers <amarok-bugs-dist> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | nhn, psychonaut, silver.salonen |
Priority: | NOR | ||
Version: | 2.3-GIT | ||
Target Milestone: | 2.3.1 | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 2.3.1 | |
Sentry Crash Report: |
Description
Alexander Potashev
2010-02-14 16:01:50 UTC
Nikolaj, could you change that, please? *** Bug 227146 has been marked as a duplicate of this bug. *** *** Bug 173904 has been marked as a duplicate of this bug. *** commit 19f83008d7c99c22a99bb65f3480b190f86a31a9 Author: Nikolaj Hald Nielsen <nhn@kde.org> Date: Wed Mar 31 13:42:56 2010 +0200 Give all AmarokUrls a "prettyCommand" name that ca be translated and shown to the user. Use the runners to actually get the prettycommand based on the command BUG: 226829 diff --git a/src/amarokurls/AmarokUrl.cpp b/src/amarokurls/AmarokUrl.cpp index 085e13c..2e3262c 100644 --- a/src/amarokurls/AmarokUrl.cpp +++ b/src/amarokurls/AmarokUrl.cpp @@ -100,6 +100,12 @@ QString AmarokUrl::command() const return m_command; } +QString +AmarokUrl::prettyCommand() const +{ + return The::amarokUrlHandler()->prettyCommand( command() ); +} + QMap<QString, QString> AmarokUrl::args() const { return m_arguments; diff --git a/src/amarokurls/AmarokUrl.h b/src/amarokurls/AmarokUrl.h index dc1aaa6..6a1d67f 100644 --- a/src/amarokurls/AmarokUrl.h +++ b/src/amarokurls/AmarokUrl.h @@ -38,6 +38,7 @@ public: void initFromString( const QString & urlString ); QString command() const; + QString prettyCommand() const; QString path() const; QMap<QString, QString> args() const; diff --git a/src/amarokurls/AmarokUrlHandler.cpp b/src/amarokurls/AmarokUrlHandler.cpp index 177573f..a8b15e1 100644 --- a/src/amarokurls/AmarokUrlHandler.cpp +++ b/src/amarokurls/AmarokUrlHandler.cpp @@ -213,6 +213,15 @@ AmarokUrlHandler::paintNewTimecode( const QString &name, int pos ) emit timecodeAdded( name, pos ); } +QString +AmarokUrlHandler::prettyCommand( const QString &command ) +{ + if( m_registeredRunners.keys().contains( command ) ) + return m_registeredRunners.value( command )->prettyCommand(); + + return i18nc( "The command type of this url is not known", "Unknown" ); +} + #include "AmarokUrlHandler.moc" diff --git a/src/amarokurls/AmarokUrlHandler.h b/src/amarokurls/AmarokUrlHandler.h index e6d091c..55f8e0c 100644 --- a/src/amarokurls/AmarokUrlHandler.h +++ b/src/amarokurls/AmarokUrlHandler.h @@ -70,6 +70,8 @@ public: AmarokUrl createPlaylistViewBookmark(); AmarokUrl createContextViewBookmark(); + QString prettyCommand( const QString &command ); + public slots: void bookmarkAlbum( Meta::AlbumPtr album ); diff --git a/src/amarokurls/AmarokUrlRunnerBase.h b/src/amarokurls/AmarokUrlRunnerBase.h index 532dad1..13a78d3 100644 --- a/src/amarokurls/AmarokUrlRunnerBase.h +++ b/src/amarokurls/AmarokUrlRunnerBase.h @@ -32,6 +32,7 @@ class AmarokUrlRunnerBase { public: virtual QString command() const = 0; + virtual QString prettyCommand() const = 0; virtual bool run( AmarokUrl url ) = 0; virtual KIcon icon() const = 0; diff --git a/src/amarokurls/BookmarkModel.cpp b/src/amarokurls/BookmarkModel.cpp index 354bd45..cf097e6 100644 --- a/src/amarokurls/BookmarkModel.cpp +++ b/src/amarokurls/BookmarkModel.cpp @@ -81,7 +81,7 @@ BookmarkModel::data( const QModelIndex & index, int role ) const { AmarokUrl * url = dynamic_cast<AmarokUrl *>( item.data() ); if ( url ) - return url->command(); + return url->prettyCommand(); else return i18n( "group" ); break; diff --git a/src/amarokurls/ContextUrlRunner.cpp b/src/amarokurls/ContextUrlRunner.cpp index c3c89ab..7416fbc 100644 --- a/src/amarokurls/ContextUrlRunner.cpp +++ b/src/amarokurls/ContextUrlRunner.cpp @@ -19,6 +19,8 @@ #include "AmarokUrlHandler.h" #include "context/ContextView.h" +#include <KLocale> + ContextUrlRunner::ContextUrlRunner() {} @@ -65,3 +67,8 @@ QString ContextUrlRunner::command() const return "context"; } +QString ContextUrlRunner::prettyCommand() const +{ + return i18nc( "A type of command that affects the context view", "Context" ); +} + diff --git a/src/amarokurls/ContextUrlRunner.h b/src/amarokurls/ContextUrlRunner.h index fc3bef5..1381cb4 100644 --- a/src/amarokurls/ContextUrlRunner.h +++ b/src/amarokurls/ContextUrlRunner.h @@ -35,6 +35,7 @@ public: virtual KIcon icon() const; virtual bool run(AmarokUrl url); virtual QString command() const; + virtual QString prettyCommand() const; }; #endif // CONTEXTURLRUNNER_H diff --git a/src/amarokurls/NavigationUrlRunner.cpp b/src/amarokurls/NavigationUrlRunner.cpp index 5cb73be..4210ea0 100644 --- a/src/amarokurls/NavigationUrlRunner.cpp +++ b/src/amarokurls/NavigationUrlRunner.cpp @@ -123,6 +123,11 @@ QString NavigationUrlRunner::command() const return "navigate"; } +QString NavigationUrlRunner::prettyCommand() const +{ + return i18nc( "A type of command that affects the view in the browser category", "Navigate" ); +} + KIcon NavigationUrlRunner::icon() const { return KIcon( "flag-amarok" ); diff --git a/src/amarokurls/NavigationUrlRunner.h b/src/amarokurls/NavigationUrlRunner.h index 30b0281..54a49ed 100644 --- a/src/amarokurls/NavigationUrlRunner.h +++ b/src/amarokurls/NavigationUrlRunner.h @@ -31,6 +31,7 @@ public: virtual ~NavigationUrlRunner(); virtual QString command() const; + virtual QString prettyCommand() const; virtual KIcon icon() const; virtual bool run( AmarokUrl url ); }; diff --git a/src/amarokurls/PlayUrlRunner.cpp b/src/amarokurls/PlayUrlRunner.cpp index 2a5b29c..eb35d02 100644 --- a/src/amarokurls/PlayUrlRunner.cpp +++ b/src/amarokurls/PlayUrlRunner.cpp @@ -79,6 +79,11 @@ QString PlayUrlRunner::command() const return "play"; } +QString PlayUrlRunner::prettyCommand() const +{ + return i18nc( "A type of command that starts playing at a specific position in a track", "Play" ); +} + BookmarkList PlayUrlRunner::bookmarksFromUrl( KUrl url ) { BookmarkList list; diff --git a/src/amarokurls/PlayUrlRunner.h b/src/amarokurls/PlayUrlRunner.h index b7d99ce..fb9800c 100644 --- a/src/amarokurls/PlayUrlRunner.h +++ b/src/amarokurls/PlayUrlRunner.h @@ -33,6 +33,7 @@ public: virtual ~PlayUrlRunner (); virtual QString command () const; + virtual QString prettyCommand() const; virtual bool run ( AmarokUrl url ); virtual KIcon icon () const; diff --git a/src/playlist/PlaylistViewUrlRunner.cpp b/src/playlist/PlaylistViewUrlRunner.cpp index d48345c..4e161da 100644 --- a/src/playlist/PlaylistViewUrlRunner.cpp +++ b/src/playlist/PlaylistViewUrlRunner.cpp @@ -101,6 +101,12 @@ ViewUrlRunner::command() const return "playlist"; } +QString +ViewUrlRunner::prettyCommand() const +{ + return i18nc( "A type of command that affects the sorting, layout and filtering int he Playlist", "Playlist" ); +} + KIcon ViewUrlRunner::icon() const { diff --git a/src/playlist/PlaylistViewUrlRunner.h b/src/playlist/PlaylistViewUrlRunner.h index 8034bd1..15ddad3 100644 --- a/src/playlist/PlaylistViewUrlRunner.h +++ b/src/playlist/PlaylistViewUrlRunner.h @@ -33,6 +33,7 @@ public: virtual ~ViewUrlRunner(); virtual QString command() const; + virtual QString prettyCommand() const; virtual KIcon icon() const; virtual bool run( AmarokUrl url ); }; diff --git a/src/services/magnatune/MagnatuneUrlRunner.cpp b/src/services/magnatune/MagnatuneUrlRunner.cpp index f1c5124..980d7ce 100644 --- a/src/services/magnatune/MagnatuneUrlRunner.cpp +++ b/src/services/magnatune/MagnatuneUrlRunner.cpp @@ -31,6 +31,11 @@ QString MagnatuneUrlRunner::command() const return "service-magnatune"; } +QString MagnatuneUrlRunner::prettyCommand() const +{ + return i18nc( "A type of command that triggers an action in the integrated Magnatune.com service", "Magnatune" ); +} + KIcon MagnatuneUrlRunner::icon() const { return KIcon( "view-services-magnatune-amarok" ); diff --git a/src/services/magnatune/MagnatuneUrlRunner.h b/src/services/magnatune/MagnatuneUrlRunner.h index 0dcef22..0a06d31 100644 --- a/src/services/magnatune/MagnatuneUrlRunner.h +++ b/src/services/magnatune/MagnatuneUrlRunner.h @@ -35,6 +35,7 @@ public: virtual ~MagnatuneUrlRunner(); virtual QString command() const; + virtual QString prettyCommand() const; virtual KIcon icon() const; virtual bool run( AmarokUrl url ); |