summaryrefslogtreecommitdiffstats
path: root/kdecore/kdesktopfile.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-02 21:21:15 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-09-02 21:21:15 +0000
commit96900dbce3aaa1fcac74a07a71482c5c6fcd3cab (patch)
treebf3fc68d0dcc660fce0e21171373a2d4e2395707 /kdecore/kdesktopfile.cpp
parent5f99bff82d3413803bcc652999f4f631058179d6 (diff)
downloadtdelibs-96900dbce3aaa1fcac74a07a71482c5c6fcd3cab.tar.gz
tdelibs-96900dbce3aaa1fcac74a07a71482c5c6fcd3cab.zip
* Large set of SuSE patches to fix bugs and add functionality
* kdemm is included but not used by knotify as it does not work out of the box git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1171141 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdecore/kdesktopfile.cpp')
-rw-r--r--kdecore/kdesktopfile.cpp31
1 files changed, 26 insertions, 5 deletions
diff --git a/kdecore/kdesktopfile.cpp b/kdecore/kdesktopfile.cpp
index c8a98e973..09a3f1e9b 100644
--- a/kdecore/kdesktopfile.cpp
+++ b/kdecore/kdesktopfile.cpp
@@ -34,6 +34,8 @@
#include "kapplication.h"
#include "kstandarddirs.h"
#include "kmountpoint.h"
+#include "kcatalogue.h"
+#include "klocale.h"
#include "kdesktopfile.h"
#include "kdesktopfile.moc"
@@ -145,6 +147,27 @@ bool KDesktopFile::isAuthorizedDesktopFile(const TQString& path)
return false;
}
+TQString KDesktopFile::translatedEntry(const char* key) const
+{
+ if (hasTranslatedKey(key))
+ return readEntry(key);
+
+ if (hasKey(key)) {
+ TQString value = readEntryUntranslated(key);
+ TQString fName = fileName();
+ fName = fName.mid(fName.findRev('/')+1);
+ TQString po_lookup_key = TQString::fromLatin1(key) + "(" + fName + "): " + value;
+ TQString po_value = KGlobal::locale()->translate(po_lookup_key.utf8().data());
+
+ if (po_value == po_lookup_key)
+ return value;
+
+ return po_value;
+ }
+
+ return TQString::null;
+}
+
TQString KDesktopFile::readType() const
{
return readEntry("Type");
@@ -157,17 +180,17 @@ TQString KDesktopFile::readIcon() const
TQString KDesktopFile::readName() const
{
- return readEntry("Name");
+ return translatedEntry("Name");
}
TQString KDesktopFile::readComment() const
{
- return readEntry("Comment");
+ return translatedEntry("Comment");
}
TQString KDesktopFile::readGenericName() const
{
- return readEntry("GenericName");
+ return translatedEntry("GenericName");
}
TQString KDesktopFile::readPath() const
@@ -342,5 +365,3 @@ KDesktopFile* KDesktopFile::copyTo(const TQString &file) const
config->setDesktopGroup();
return config;
}
-
-