Home · All Namespaces · All Classes · Main Classes
Public Slots | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends

DcpRetranslator Class Reference

makes translation reload automatically More...

#include <dcpretranslator.h>

List of all members.

Public Slots

void retranslate ()

Public Member Functions

 ~DcpRetranslator ()
void setMainCatalogName (const QString &catalogName)
void ensureTranslationsAreLoaded (const DcpAppletMetadataList &list)
void ensureTranslationLoaded (DcpAppletMetadata *metadata)
void ensureTranslationsAreLoaded (const QStringList &catalogs)

Static Public Member Functions

static DcpRetranslatorinstance ()
static void destroy ()

Protected Member Functions

 DcpRetranslator ()
bool eventFilter (QObject *obj, QEvent *event)
bool loadAppletTranslation (MLocale &locale, const DcpAppletMetadata *metadata)
 Loads the translation for the applet into locale.
bool loadTranslations (MLocale &locale, const QStringList &catalogList)

Protected Attributes

class DcpRetranslatorPriv * priv

Friends

class Ut_DcpRetranslator

Detailed Description

makes translation reload automatically

MApplication's localeSettingsChanged signal should be connected on the retranslate slot, which loads the new translation. Also handles loading applet translations, they just should have the filename "duicontrolpanel-<appletname>.qm"

Widgets have to define their retranslateUi() virtual function properly, so that changes (new translations) could be shown immediately.


Constructor & Destructor Documentation

DcpRetranslator::~DcpRetranslator (  ) 
DcpRetranslator::DcpRetranslator (  )  [protected]

Member Function Documentation

void DcpRetranslator::destroy ( void   )  [static]

Destroys the instance if any.

void DcpRetranslator::ensureTranslationLoaded ( DcpAppletMetadata metadata  ) 
void DcpRetranslator::ensureTranslationsAreLoaded ( const DcpAppletMetadataList list  ) 
void DcpRetranslator::ensureTranslationsAreLoaded ( const QStringList &  catalogs  ) 
bool DcpRetranslator::eventFilter ( QObject *  obj,
QEvent *  event 
) [protected]

Filters out unnecessery LanguageChange events

If installed on a QApplication it will filter out all LanguageChange events which are not intentional in the sence that they are not caused by the retranslateUi. This can cause problems of course, so dont use it ;)

DcpRetranslator * DcpRetranslator::instance (  )  [static]

The retranslator is in compatibility mode if you call it with its constructor, so as not to cause problems with suw or other program, which are also using the retranslator. In compatibility mode retranslator behaves like before: it reloads the translations for all applets, which are in the db.

If you call it trough instance() it will not be in compatibility mode, which means it only reloads the translations for the active plugins, see DcpAppletMetadata::isActive(), and apps have to call ensureLoaded functions to load the translations for the actives.

bool DcpRetranslator::loadAppletTranslation ( MLocale &  locale,
const DcpAppletMetadata metadata 
) [protected]

Loads the translation for the applet into locale.

Returns:
true if the locale was modified, false otherwise.

Note that false return value does not indicate an error, it is also possible that the translation was already loaded, so no modification was necessery.

bool DcpRetranslator::loadTranslations ( MLocale &  locale,
const QStringList &  catalogList 
) [protected]
void DcpRetranslator::retranslate (  )  [slot]
void DcpRetranslator::setMainCatalogName ( const QString &  catalogName  ) 

Friends And Related Function Documentation

friend class Ut_DcpRetranslator [friend]

Member Data Documentation

class DcpRetranslatorPriv* DcpRetranslator::priv [protected]

The documentation for this class was generated from the following files:

Copyright © 2009 Nokia Corporation Generated on Tue Jul 5 2011 15:01:31
Doxygen 1.7.1
Meego control panel