Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
isv:hp:education
kdelibs3
desktop-translations.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File desktop-translations.diff of Package kdelibs3
--- kio/kfile/kpropertiesdialog.cpp (Revision 505306) +++ kio/kfile/kpropertiesdialog.cpp (Revision 505307) @@ -3103,12 +3103,10 @@ KDesktopPropsPlugin::KDesktopPropsPlugin return; f.close(); - KSimpleConfig config( path ); - config.setDollarExpansion( false ); - config.setDesktopGroup(); - QString nameStr = config.readEntry( "Name" ); - QString genNameStr = config.readEntry( "GenericName" ); - QString commentStr = config.readEntry( "Comment" ); + KDesktopFile config( path ); + QString nameStr = config.readName(); + QString genNameStr = config.readGenericName(); + QString commentStr = config.readComment(); QString commandStr = config.readPathEntry( "Exec" ); if (commandStr.left(12) == "ksystraycmd ") { @@ -3951,16 +3949,15 @@ KApplicationPropsPlugin::KApplicationPro return; f.close(); - KSimpleConfig config( path ); - config.setDesktopGroup(); - QString commentStr = config.readEntry( "Comment" ); - QString genNameStr = config.readEntry( "GenericName" ); + KDesktopFile config( path ); + QString commentStr = config.readComment(); + QString genNameStr = config.readGenericName(); QStringList selectedTypes = config.readListEntry( "ServiceTypes" ); // For compatibility with KDE 1.x selectedTypes += config.readListEntry( "MimeType", ';' ); - QString nameStr = config.readEntry( QString::fromLatin1("Name") ); + QString nameStr = config.readName(); if ( nameStr.isEmpty() || d->m_kdesktopMode ) { // We'll use the file name if no name is specified // because we _need_ a Name for a valid file. Index: kio/kio/kmimetype.cpp =================================================================== --- kio/kio/kmimetype.cpp (Revision 506454) +++ kio/kio/kmimetype.cpp (Arbeitskopie) @@ -679,9 +679,8 @@ QString KFolderType::comment( const KURL KURL u( _url ); u.addPath( ".directory" ); - KSimpleConfig cfg( u.path(), true ); - cfg.setDesktopGroup(); - QString comment = cfg.readEntry( "Comment" ); + KDesktopFile cfg( u.path(), true ); + QString comment = cfg.readComment(); if ( comment.isEmpty() ) return KMimeType::comment( _url, _is_local ); @@ -774,9 +773,8 @@ QString KDEDesktopMimeType::comment( con if ( !_is_local ) return KMimeType::comment( _url, _is_local ); - KSimpleConfig cfg( _url.path(), true ); - cfg.setDesktopGroup(); - QString comment = cfg.readEntry( "Comment" ); + KDesktopFile cfg( _url.path(), true ); + QString comment = cfg.readComment(); if ( comment.isEmpty() ) return KMimeType::comment( _url, _is_local ); Index: kio/kio/kservicegroup.cpp =================================================================== --- kio/kio/kservicegroup.cpp (Revision 506454) +++ kio/kio/kservicegroup.cpp (Arbeitskopie) @@ -62,13 +62,11 @@ KServiceGroup::KServiceGroup( const QStr d->directoryEntryPath = cfg; - KConfig config( cfg, true, false, "apps" ); + KDesktopFile config( cfg, true, "apps" ); - config.setDesktopGroup(); - - m_strCaption = config.readEntry( "Name" ); + m_strCaption = config.readName(); m_strIcon = config.readEntry( "Icon" ); - m_strComment = config.readEntry( "Comment" ); + m_strComment = config.readComment(); m_bDeleted = config.readBoolEntry( "Hidden", false ); d->m_bNoDisplay = config.readBoolEntry( "NoDisplay", false ); QStringList tmpList; Index: kio/kio/kservice.cpp =================================================================== --- kio/kio/kservice.cpp (Revision 506454) +++ kio/kio/kservice.cpp (Arbeitskopie) @@ -113,7 +113,7 @@ KService::init( KDesktopFile *config ) return; } - m_strName = config->readEntry( "Name" ); + m_strName = config->readName(); entryMap.remove("Name"); if ( m_strName.isEmpty() ) { @@ -202,9 +202,9 @@ KService::init( KDesktopFile *config ) entryMap.remove("TerminalOptions"); m_strPath = config->readPathEntry( "Path" ); entryMap.remove("Path"); - m_strComment = config->readEntry( "Comment" ); + m_strComment = config->readComment(); entryMap.remove("Comment"); - m_strGenName = config->readEntry( "GenericName" ); + m_strGenName = config->readGenericName(); entryMap.remove("GenericName"); QString untranslatedGenericName = config->readEntryUntranslated( "GenericName" ); entryMap.insert("UntranslatedGenericName", untranslatedGenericName); Index: kutils/kplugininfo.cpp =================================================================== --- kutils/kplugininfo.cpp (Revision 506454) +++ kutils/kplugininfo.cpp (Arbeitskopie) @@ -24,6 +24,7 @@ #include <kconfigbase.h> #include <kglobal.h> #include <kstandarddirs.h> +#include <kdesktopfile.h> #include <kservice.h> class KPluginInfo::KPluginInfoPrivate @@ -69,7 +70,7 @@ class KPluginInfo::KPluginInfoPrivate KPluginInfo::KPluginInfo( const QString & filename, const char* resource ) : d( new KPluginInfoPrivate ) { - KConfig file( filename, true, true, resource ); + KDesktopFile file( filename, true, resource ); d->specfile = filename; @@ -80,8 +81,8 @@ KPluginInfo::KPluginInfo( const QString if( d->hidden ) return; - d->name = file.readEntry( "Name" ); - d->comment = file.readEntry( "Comment" ); + d->name = file.readName(); + d->comment = file.readComment(); d->icon = file.readEntry( "Icon" ); d->author = file.readEntry( "X-KDE-PluginInfo-Author" ); d->email = file.readEntry( "X-KDE-PluginInfo-Email" ); @@ -97,8 +98,8 @@ KPluginInfo::KPluginInfo( const QString else if( filename.endsWith( QString::fromAscii( ".plugin" ) ) ) { // provided for noatun style .plugin files compatibility - d->name = file.readEntry( "Name" ); - d->comment = file.readEntry( "Comment" ); + d->name = file.readName(); + d->comment = file.readComment(); d->icon = file.readEntry( "Icon" ); d->author = file.readEntry( "Author" ); d->email = file.readEntry( "Email" ); Index: kdecore/kconfigbase.h =================================================================== --- kdecore/kconfigbase.h (Revision 506454) +++ kdecore/kconfigbase.h (Arbeitskopie) @@ -1985,6 +1985,7 @@ public: protected: QCString readEntryUtf8( const char *pKey) const; + bool hasTranslatedKey( const char *pKey ) const; /** * The currently selected group. */ Index: kdecore/kconfigbase.cpp =================================================================== --- kdecore/kconfigbase.cpp (Revision 506454) +++ kdecore/kconfigbase.cpp (Arbeitskopie) @@ -131,6 +131,24 @@ bool KConfigBase::hasKey(const char *pKe return !entry.mValue.isNull(); } +bool KConfigBase::hasTranslatedKey(const char* pKey) const +{ + KEntryKey aEntryKey(mGroup, 0); + aEntryKey.c_key = pKey; + aEntryKey.bDefault = readDefaults(); + + if (!locale().isNull()) { + // try the localized key first + aEntryKey.bLocal = true; + KEntry entry = lookupData(aEntryKey); + if (!entry.mValue.isNull()) + return true; + aEntryKey.bLocal = false; + } + + return false; +} + bool KConfigBase::hasGroup(const QString &group) const { return internalHasGroup( group.utf8()); Index: kdecore/kdesktopfile.h =================================================================== --- kdecore/kdesktopfile.h (Revision 506454) +++ kdecore/kdesktopfile.h (Arbeitskopie) @@ -236,6 +236,8 @@ private: private: + QString translatedEntry(const char*) const; + // copy-construction and assignment are not allowed KDesktopFile( const KDesktopFile& ); KDesktopFile& operator= ( const KDesktopFile& ); Index: kdecore/kdesktopfile.cpp =================================================================== --- kdecore/kdesktopfile.cpp (Revision 506454) +++ kdecore/kdesktopfile.cpp (Arbeitskopie) @@ -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::isAuthorizedDesktopFi return false; } +QString KDesktopFile::translatedEntry(const char* key) const +{ + if (hasTranslatedKey(key)) + return readEntry(key); + + if (hasKey(key)) { + QString value = readEntryUntranslated(key); + QString fName = fileName(); + fName = fName.mid(fName.findRev('/')+1); + QString po_lookup_key = QString::fromLatin1(key) + "(" + fName + "): " + value; + QString po_value = KGlobal::locale()->translate(po_lookup_key.utf8().data()); + + if (po_value == po_lookup_key) + return value; + + return po_value; + } + + return QString::null; +} + QString KDesktopFile::readType() const { return readEntry("Type"); @@ -157,17 +180,17 @@ QString KDesktopFile::readIcon() const QString KDesktopFile::readName() const { - return readEntry("Name"); + return translatedEntry("Name"); } QString KDesktopFile::readComment() const { - return readEntry("Comment"); + return translatedEntry("Comment"); } QString KDesktopFile::readGenericName() const { - return readEntry("GenericName"); + return translatedEntry("GenericName"); } QString KDesktopFile::readPath() const @@ -342,5 +365,3 @@ KDesktopFile* KDesktopFile::copyTo(const config->setDesktopGroup(); return config; } - -
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor