[SCM] ktp-common-internals packaging branch, master, updated. debian/15.12.1-2-1839-gf0635e9

Maximiliano Curia maxy at moszumanska.debian.org
Mon May 9 09:06:46 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=ae56f6c

The following commit has been merged in the master branch:
commit ae56f6c10f3cdedbe8088c71c24b555531b25b8d
Author: Dan Vrátil <dvratil at redhat.com>
Date:   Fri Apr 12 19:15:16 2013 +0200

    Load translation catalog and fix use of i18n in global scope
    
    In order for KLocale to work, i18n() must not be used
    in global static variables, because these are initialised
    before KLocale. Use I18N_NOOP instead to mark the string
    for translation and use i18n to perform the actual
    lookup of the translated string only before displaying
    the string to user.
    
    Reviewed-By: David Edmundson
    BUG: 318190
    FIXED-IN: 0.6.1
---
 CMakeLists.txt                 |  2 ++
 KTp/CMakeLists.txt             |  1 +
 KTp/Declarative/CMakeLists.txt |  1 +
 KTp/Models/CMakeLists.txt      |  1 +
 KTp/Widgets/CMakeLists.txt     |  1 +
 KTp/contact-info-dialog.cpp    | 22 ++++++++++++----------
 KTp/ktp-export.h => global.cpp | 29 ++++-------------------------
 7 files changed, 22 insertions(+), 35 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d733bb9..6fde942 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,6 +38,8 @@ include_directories (${KDE4_INCLUDES}
 
 configure_file(version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h @ONLY)
 
+set(KTP_GLOBAL_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/global.cpp)
+
 add_subdirectory(KTp)
 add_subdirectory(tools)
 add_subdirectory(data)
diff --git a/KTp/CMakeLists.txt b/KTp/CMakeLists.txt
index 322c5d0..6b3de56 100644
--- a/KTp/CMakeLists.txt
+++ b/KTp/CMakeLists.txt
@@ -2,6 +2,7 @@ include_directories (${CMAKE_CURRENT_BINARY_DIR}
                      ${CMAKE_CURRENT_SOURCE_DIR})
 
 set (ktp_common_internals_private_SRCS
+     ${KTP_GLOBAL_SOURCES}
      abstract-message-filter.cpp
      actions.cpp
      capabilities-hack-private.cpp
diff --git a/KTp/Declarative/CMakeLists.txt b/KTp/Declarative/CMakeLists.txt
index 32ec1c6..d5b8984 100644
--- a/KTp/Declarative/CMakeLists.txt
+++ b/KTp/Declarative/CMakeLists.txt
@@ -4,6 +4,7 @@ include_directories (${CMAKE_CURRENT_BINARY_DIR}
 )
 
 set (ktp_qml_plugin_SRCS
+    ${KTP_GLOBAL_SOURCES}
     contact-list.cpp
     conversation-queue-manager.cpp
     conversation-target.cpp
diff --git a/KTp/Models/CMakeLists.txt b/KTp/Models/CMakeLists.txt
index 560747c..720a5b0 100644
--- a/KTp/Models/CMakeLists.txt
+++ b/KTp/Models/CMakeLists.txt
@@ -4,6 +4,7 @@ include_directories (${CMAKE_CURRENT_BINARY_DIR}
 )
 
 set (ktp_models_private_SRCS
+    ${KTP_GLOBAL_SOURCES}
     abstract-grouping-proxy-model.cpp
     accounts-list-model.cpp
     accounts-tree-proxy-model.cpp
diff --git a/KTp/Widgets/CMakeLists.txt b/KTp/Widgets/CMakeLists.txt
index 5bed94a..3bd5167 100644
--- a/KTp/Widgets/CMakeLists.txt
+++ b/KTp/Widgets/CMakeLists.txt
@@ -3,6 +3,7 @@ include_directories (${CMAKE_CURRENT_BINARY_DIR}
 )
 
 set (ktp_widgets_private_SRCS
+    ${KTP_GLOBAL_SOURCES}
     contact-grid-widget.cpp
     contact-grid-dialog.cpp
     add-contact-dialog.cpp
diff --git a/KTp/contact-info-dialog.cpp b/KTp/contact-info-dialog.cpp
index 6584fcb..fa5ed5f 100644
--- a/KTp/contact-info-dialog.cpp
+++ b/KTp/contact-info-dialog.cpp
@@ -61,15 +61,15 @@ enum InfoRowIndex {
 static struct InfoRow {
     const InfoRowIndex index;
     const QString fieldName;
-    const QString title;
-} InfoRows[] = {
-    { FullName,         QLatin1String("fn"),            i18n("Full name:") },
-    { Nickname,         QLatin1String("nickname"),      i18n("Nickname:") },
-    { Email,            QLatin1String("email"),         i18n("Email:") },
-    { Phone,            QLatin1String("tel"),           i18n("Phone:") },
-    { Homepage,         QLatin1String("url"),           i18n("Homepage:") },
-    { Birthday,         QLatin1String("bday"),          i18n("Birthday:") },
-    { Organization,     QLatin1String("org"),           i18n("Organization:") }
+    const char* title;
+} InfoRows[] = {                                        // Don't use i18n in global static vars
+    { FullName,         QLatin1String("fn"),            I18N_NOOP("Full name:") },
+    { Nickname,         QLatin1String("nickname"),      I18N_NOOP("Nickname:") },
+    { Email,            QLatin1String("email"),         I18N_NOOP("Email:") },
+    { Phone,            QLatin1String("tel"),           I18N_NOOP("Phone:") },
+    { Homepage,         QLatin1String("url"),           I18N_NOOP("Homepage:") },
+    { Birthday,         QLatin1String("bday"),          I18N_NOOP("Birthday:") },
+    { Organization,     QLatin1String("org"),           I18N_NOOP("Organization:") }
 };
 
 class ContactInfoDialog::Private
@@ -238,7 +238,9 @@ void ContactInfoDialog::Private::addInfoRow(InfoRowIndex index, const QString &v
 {
     InfoRow *row = &InfoRows[index];
 
-    QLabel *descriptionLabel = new QLabel(row->title, q);
+    // I18N_NOOP only marks the string for translation, the actual lookup of
+    // translated row->title happens here
+    QLabel *descriptionLabel = new QLabel(i18n(row->title), q);
     QFont font = descriptionLabel->font();
     font.setBold(true);
     descriptionLabel->setFont(font);
diff --git a/KTp/ktp-export.h b/global.cpp
similarity index 57%
copy from KTp/ktp-export.h
copy to global.cpp
index 86e9b1c..18c525a 100644
--- a/KTp/ktp-export.h
+++ b/global.cpp
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2011 Dario Freddi <drf at kde.org>
- * Copyright (C) 2007 David Faure <faure at kde.org>
+ * Copyright (C) 2013 Daniel Vrátil <dvratil at redhat.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -18,28 +17,8 @@
  * Boston, MA 02110-1301, USA.
  */
 
-#ifndef KTP_EXPORT_H
-#define KTP_EXPORT_H
+#include <KGlobal>
 
-/** 
ile ktp-export.h
-    rief Contains Macros for exporting symbols
-
-    This file contains macros needed for exporting/importing symbols
-*/
-
-#include <QtCore/QtGlobal>
-
-#ifndef KTP_EXPORT
-# if defined(MAKE_KTP_LIB)
-/* We are building this library */
-#  define KTP_EXPORT Q_DECL_EXPORT
-# else
-/* We are using this library */
-#  define KTP_EXPORT Q_DECL_IMPORT
-# endif
-#endif
-
-#define KTP_NO_EXPORT Q_DECL_HIDDEN
-
-#endif /*KTP_EXPORT_H*/
+//Load i18n catalog
+static const KCatalogLoader loader(QLatin1String("ktp-common-internals"));
 

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list