diff options
author | Francois Andriot <francois.andriot@free.fr> | 2013-05-19 16:12:30 +0200 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2013-05-19 16:58:19 +0200 |
commit | 940b88652a39b775c94749fcbe7b3a0069b122f0 (patch) | |
tree | 9e5e7f3139f1be985493e20eed3f4af8ac2332f8 | |
parent | 4844466a7d3358a673a6a5afaf0a087342cc4ae6 (diff) | |
download | tdebase-940b88652a39b775c94749fcbe7b3a0069b122f0.tar.gz tdebase-940b88652a39b775c94749fcbe7b3a0069b122f0.zip |
Fix media name translations in halbackend
(cherry picked from commit 9a491179e30feb8beb9ceca8b1fde985d42465e7)
-rw-r--r-- | kioslave/media/mediamanager/halbackend.cpp | 12 | ||||
-rw-r--r-- | kioslave/media/mediamanager/halbackend.h | 1 |
2 files changed, 12 insertions, 1 deletions
diff --git a/kioslave/media/mediamanager/halbackend.cpp b/kioslave/media/mediamanager/halbackend.cpp index 623a3d4ed..44a5d6113 100644 --- a/kioslave/media/mediamanager/halbackend.cpp +++ b/kioslave/media/mediamanager/halbackend.cpp @@ -545,7 +545,17 @@ void HALBackend::setVolumeProperties(Medium* medium) char* name = libhal_volume_policy_compute_display_name(halDrive, halVolume, m_halStoragePolicy); TQString volume_name = TQString::fromUtf8(name); TQString media_name = volume_name; - medium->setLabel(media_name); + /* media_name contains something like "501M Removable Media" or "Blank CD-R" + The former needs special handling for correct translation + */ + if (media_name.find(TQRegExp("^[0-9]+\\.?[0-9]*[KMGT] (Removable )?Media$")) > -1) { + TQString pattern = media_name.section(" ", 1); + media_name.replace(pattern, i18n(pattern.ascii())); + medium->setLabel(media_name); + } else { + medium->setLabel(i18n(media_name.ascii())); + } + free(name); TQString mimeType; diff --git a/kioslave/media/mediamanager/halbackend.h b/kioslave/media/mediamanager/halbackend.h index 18de7ea3c..9bd840a6e 100644 --- a/kioslave/media/mediamanager/halbackend.h +++ b/kioslave/media/mediamanager/halbackend.h @@ -34,6 +34,7 @@ #include <tqobject.h> #include <tqstringlist.h> #include <tqstring.h> +#include <tqregexp.h> #include <config.h> |