[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kdecore/kernel
From:       Albert Astals Cid <tsdgeos () terra ! es>
Date:       2010-11-30 19:54:56
Message-ID: 20101130195456.673DAAC8A3 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1202414 by aacid:

The K_CATALOG_LOADER macro didn't work with catalogs that had a - in the name so remove it and use a name


 M  +6 -0      kglobal.cpp  
 M  +11 -16    kglobal.h  


--- trunk/KDE/kdelibs/kdecore/kernel/kglobal.cpp #1202413:1202414
@@ -118,6 +118,12 @@
         }
 };
 
+KCatalogLoader::KCatalogLoader(const QString &catalogName)
+{
+    KGlobal::insertCatalog(catalogName);
+}
+
+
 K_GLOBAL_STATIC(KGlobalPrivate, globalData)
 K_GLOBAL_STATIC_WITH_ARGS(KComponentData, fakeComponent, (KGlobalPrivate::initFakeComponent()))
 
--- trunk/KDE/kdelibs/kdecore/kernel/kglobal.h #1202413:1202414
@@ -300,31 +300,26 @@
 } NAME;
 
 /**
- * This macro is useful in libraries where you want to make sure that
+ * This class is useful in libraries where you want to make sure that
  * anyone that uses your library will get the correct catalog loaded.
+ * Just declare a static KCatalogLoader in the global namespace of one of
+ * your cpp files and that will load your catalog once
+ * the global klocale is created
  *
- * @param CATALOGNAME The name of your catalog
+ * @param catalogName The name of your catalog
  *
  * @since 4.6
  *
  * Example:
  * @code
- * K_CATALOG_LOADER(libkdepim)
+ * static const KCatalogLoader loader("libkdepim");
  * @endcode
- * 
- * @ingroup KDEMacros
  */
-#define K_CATALOG_LOADER(CATALOGNAME)                               \
-class KCatalogLoader##CATALOGNAME                                   \
-{                                                                   \
-    public:                                                         \
-        KCatalogLoader##CATALOGNAME();                              \
-};                                                                  \
-static KCatalogLoader##CATALOGNAME catalogLoader##CATALOGNAME;      \
-KCatalogLoader##CATALOGNAME::KCatalogLoader##CATALOGNAME()          \
-{                                                                   \
-    KGlobal::insertCatalog(QLatin1String(#CATALOGNAME));            \
-}
+class KCatalogLoader
+{
+    public:
+        KCatalogLoader(const QString &catalogName);
+};
 
 /**
  * Access to the KDE global objects.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic