Author: kmachalkova
Date: Thu May 28 15:22:16 2009
New Revision: 57348
URL: http://svn.opensuse.org/viewcvs/yast?rev=57348&view=rev
Log:
Translated module and group names
Modified:
branches/tmp/tgoettlicher/yast2cc_rewrite/src/yqdesktopfilesmodel.cpp
branches/tmp/tgoettlicher/yast2cc_rewrite/src/yqdesktopfilesmodel.h
Modified: branches/tmp/tgoettlicher/yast2cc_rewrite/src/yqdesktopfilesmodel.cpp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/tgoettlicher/yast2cc_rewrite/src/yqdesktopfilesmodel.cpp?rev=57348&r1=57347&r2=57348&view=diff
==============================================================================
--- branches/tmp/tgoettlicher/yast2cc_rewrite/src/yqdesktopfilesmodel.cpp (original)
+++ branches/tmp/tgoettlicher/yast2cc_rewrite/src/yqdesktopfilesmodel.cpp Thu May 28 15:22:16 2009
@@ -13,8 +13,11 @@
#include <QDir>
#include <QIcon>
#include <QMap>
+#include
#include "yqdesktopfilesmodel.h"
+
+#define DESKTOP_TRANSLATIONS "desktop_translations"
YQDesktopFilesModel::YQDesktopFilesModel( const QString &dir, QObject * parent )
: QAbstractItemModel(parent)
@@ -24,6 +27,9 @@
SLOT(slotDesktopFilesDirectoryChanged( const QString & ) ) );
addDesktopFilesPath(dir);
+ bindtextdomain( DESKTOP_TRANSLATIONS, DESKTOP_TRANSLATIONS_DIR );
+ bind_textdomain_codeset( DESKTOP_TRANSLATIONS, "utf8" );
+
}
YQDesktopFilesModel::~YQDesktopFilesModel()
@@ -199,6 +205,25 @@
return QVariant();
}
+QVariant YQDesktopFilesModel::translatedPropertyValue( const QModelIndex &index, const QString &key ) const
+{
+ QString fname = d->desktop_files.value( index.row() );
+ QFileInfo fi(fname);
+ QString value = propertyValue(index, key).toString();
+
+ QString msgid = QString( "%1(%2)" ).arg( key, fi.fileName() );
+ msgid += ": ";
+ msgid += value;
+
+ QString msgstr = QString::fromUtf8( dgettext ( DESKTOP_TRANSLATIONS, msgid.toAscii()) );
+
+ if( msgid == msgstr)
+ return value;
+ else
+ return msgstr;
+
+}
+
void YQDesktopFilesModel::sort( int, Qt::SortOrder order )
{
emit layoutAboutToBeChanged();
@@ -217,7 +242,7 @@
// check the role and column
if ( role == Qt::DisplayRole )
{
- return propertyValue( index, "Name" );
+ return translatedPropertyValue( index, "Name");
}
else if ( role == Qt::DecorationRole )
{
@@ -238,6 +263,7 @@
}
else if ( role == Qt::UserRole )
{
+
// user role has app specific data
switch ( index.column() )
{
Modified: branches/tmp/tgoettlicher/yast2cc_rewrite/src/yqdesktopfilesmodel.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/tgoettlicher/yast2cc_rewrite/src/yqdesktopfilesmodel.h?rev=57348&r1=57347&r2=57348&view=diff
==============================================================================
--- branches/tmp/tgoettlicher/yast2cc_rewrite/src/yqdesktopfilesmodel.h (original)
+++ branches/tmp/tgoettlicher/yast2cc_rewrite/src/yqdesktopfilesmodel.h Thu May 28 15:22:16 2009
@@ -77,6 +77,7 @@
* returns the desktop file property for the given key
*/
QVariant propertyValue( const QModelIndex &index, const QString &key ) const;
+ QVariant translatedPropertyValue( const QModelIndex &index, const QString &key ) const;
virtual QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const;
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org