Commit 261bec48 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port deprecated I18N macro

parent dd591c7d
Pipeline #98192 canceled with stage
......@@ -153,7 +153,7 @@ if(BUILD_TESTING)
add_definitions(-DBUILD_TESTING)
endif()
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050f02)
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x055900)
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x055800)
find_package(KUserFeedback 1.0.0 CONFIG)
set_package_properties(KUserFeedback PROPERTIES DESCRIPTION "User Feedback lib" TYPE OPTIONAL PURPOSE "Allow to send Telemetry Information (optional). It can be disable in apps.")
......
This diff is collapsed.
......@@ -56,6 +56,7 @@ using namespace PimCommon::ConfigureImmutableWidgetUtils;
#include <KMime/DateFormatter>
#include "ki18n_version.h"
#include <QButtonGroup>
#include <QCheckBox>
#include <QFontDatabase>
......@@ -66,6 +67,11 @@ using namespace PimCommon::ConfigureImmutableWidgetUtils;
#include <QSpinBox>
#include <QVBoxLayout>
#include <QWhatsThis>
#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0)
#include <klazylocalizedstring.h>
#undef I18N_NOOP
#define I18N_NOOP kli18n
#endif
using KMime::DateFormatter;
using namespace MailCommon;
......@@ -123,7 +129,11 @@ QString AppearancePageFontsTab::helpAnchor() const
static const struct {
const char *configName;
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
const char *displayName;
#else
const KLazyLocalizedString displayName;
#endif
bool enableFamilyAndSize;
bool onlyFixed;
} fontNames[] = {
......@@ -159,7 +169,11 @@ AppearancePageFontsTab::AppearancePageFontsTab(QWidget *parent)
QStringList fontDescriptions;
fontDescriptions.reserve(numFontNames);
for (int i = 0; i < numFontNames; ++i) {
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
fontDescriptions << i18n(fontNames[i].displayName);
#else
fontDescriptions << KLocalizedString(fontNames[i].displayName).toString();
#endif
}
mFontLocationCombo->addItems(fontDescriptions);
......@@ -297,7 +311,11 @@ QString AppearancePageColorsTab::helpAnchor() const
static const struct {
const char *configName;
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
const char *displayName;
#else
const KLazyLocalizedString displayName;
#endif
} colorNames[] = { // adjust doLoadOther if you change this:
{"QuotedText1", I18N_NOOP("Quoted Text - First Level")},
{"QuotedText2", I18N_NOOP("Quoted Text - Second Level")},
......@@ -329,7 +347,11 @@ AppearancePageColorsTab::AppearancePageColorsTab(QWidget *parent)
mColorList = new ColorListBox(this);
mColorList->setEnabled(false); // since !mCustomColorCheck->isChecked()
for (int i = 0; i < numColorNames; ++i) {
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
mColorList->addColor(i18n(colorNames[i].displayName));
#else
mColorList->addColor(KLocalizedString(colorNames[i].displayName).toString());
#endif
}
vlay->addWidget(mColorList, 1);
......@@ -558,7 +580,11 @@ QString AppearancePageHeadersTab::helpAnchor() const
}
static const struct {
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
const char *displayName;
#else
const KLazyLocalizedString displayName;
#endif
DateFormatter::FormatType dateDisplay;
} dateDisplayConfig[] = {{I18N_NOOP("Sta&ndard format (%1)"), KMime::DateFormatter::CTime},
{I18N_NOOP("Locali&zed format (%1)"), KMime::DateFormatter::Localized},
......@@ -614,7 +640,12 @@ AppearancePageHeadersTab::AppearancePageHeadersTab(QWidget *parent)
mDateDisplay->setExclusive(true);
for (int i = 0; i < numDateDisplayConfig; ++i) {
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
const char *label = dateDisplayConfig[i].displayName;
#else
const char *label = KLocalizedString(dateDisplayConfig[i].displayName).toString().toLatin1().constData();
#endif
QString buttonLabel;
if (QString::fromLatin1(label).contains(QLatin1String("%1"))) {
buttonLabel = i18n(label, DateFormatter::formatCurrentDate(dateDisplayConfig[i].dateDisplay));
......
......@@ -67,6 +67,13 @@ using namespace MessageViewer;
#include <MailCommon/MailUtil>
#include "ki18n_version.h"
#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0)
#include <klazylocalizedstring.h>
#undef I18N_NOOP
#define I18N_NOOP kli18n
#endif
using namespace KMail;
using namespace MailCommon;
......@@ -243,7 +250,11 @@ void KMReaderWin::hasMultiMessages(bool multi)
}
// enter items for the "Important changes" list here:
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
static const char *const kmailChanges[] = {
#else
static const KLazyLocalizedString kmailChanges[] = {
#endif
I18N_NOOP("KMail is now based on the Akonadi Personal Information Management framework, which brings many "
"changes all around.")};
static const int numKMailChanges = sizeof kmailChanges / sizeof *kmailChanges;
......@@ -252,7 +263,12 @@ static const int numKMailChanges = sizeof kmailChanges / sizeof *kmailChanges;
// the welcome page can be left untouched (probably much easier for
// the translators). Note that the <li>...</li> tags are added
// automatically below:
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
static const char *const kmailNewFeatures[] = {
#else
static const KLazyLocalizedString kmailNewFeatures[] = {
#endif
I18N_NOOP("Push email (IMAP IDLE)"),
I18N_NOOP("Improved searches"),
I18N_NOOP("Support for adding notes (annotations) to mails"),
......@@ -273,10 +289,18 @@ QString KMReaderWin::newFeaturesMD5()
{
QByteArray str;
for (int i = 0; i < numKMailChanges; ++i) {
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
str += kmailChanges[i];
#else
str += KLocalizedString(kmailChanges[i]).untranslatedText();
#endif
}
for (int i = 0; i < numKMailNewFeatures; ++i) {
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
str += kmailNewFeatures[i];
#else
str += KLocalizedString(kmailNewFeatures[i]).untranslatedText();
#endif
}
QCryptographicHash md5(QCryptographicHash::Md5);
md5.addData(str);
......@@ -332,14 +356,22 @@ void KMReaderWin::displayAboutPage()
QVariantList features;
features.reserve(numKMailNewFeatures);
for (int i = 0; i < numKMailNewFeatures; ++i) {
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
features.push_back(i18n(kmailNewFeatures[i]));
#else
features.push_back(KLocalizedString(kmailNewFeatures[i]).toString());
#endif
}
data[QStringLiteral("newFeatures")] = features;
QVariantList changes;
changes.reserve(numKMailChanges);
for (int i = 0; i < numKMailChanges; ++i) {
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
features.push_back(i18n(kmailChanges[i]));
#else
features.push_back(KLocalizedString(kmailChanges[i]).toString());
#endif
}
data[QStringLiteral("importantChanges")] = changes;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment