Remove deprecated I18N_NOOP macro

wilder-rebase
Laurent Montel 4 years ago
parent 2c7b5eecbf
commit dc61356ded
  1. 2
      CMakeLists.txt
  2. 32
      src/search/searchpatternedit.cpp
  3. 15
      src/search/widgethandler/daterulewidgethandler.cpp
  4. 15
      src/search/widgethandler/encryptionwidgethandler.cpp
  5. 15
      src/search/widgethandler/headersrulerwidgethandler.cpp
  6. 15
      src/search/widgethandler/messagerulewidgethandler.cpp
  7. 15
      src/search/widgethandler/numericdoublerulewidgethandler.cpp
  8. 15
      src/search/widgethandler/numericrulewidgethandler.cpp
  9. 15
      src/search/widgethandler/statusrulewidgethandler.cpp
  10. 19
      src/search/widgethandler/tagrulewidgethandler.cpp
  11. 14
      src/search/widgethandler/textrulerwidgethandler.cpp

@ -101,7 +101,7 @@ 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)
########### CMake Config Files ###########
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5MailCommon")

@ -10,6 +10,7 @@
using MailCommon::RuleWidgetHandlerManager;
#include "mailcommon_debug.h"
#include "ki18n_version.h"
#include <KComboBox>
#include <KLocalizedString>
#include <Libkdepim/LineEditCatchReturnKey>
@ -21,26 +22,35 @@ using MailCommon::RuleWidgetHandlerManager;
#include <QPushButton>
#include <QRadioButton>
#include <QStackedWidget>
#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0)
#include <klazylocalizedstring.h>
#undef I18N_NOOP
#define I18N_NOOP kli18n
#endif
// Definition of special rule field strings
// Note: Also see SearchRule::matches() and ruleFieldToEnglish() if
// you change the following i18n-ized strings!
// Note: The index of the values in the following array has to correspond to
// the value of the entries in the enum in SearchRuleWidget.
#undef I18N_NOOP
#define I18N_NOOP(t) nullptr, t
using namespace MailCommon;
static const struct {
const char *internalName;
const char *context;
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
const char *displayName;
#else
const KLazyLocalizedString displayName;
#endif
QString getLocalizedDisplayName() const
{
return i18nc(context, displayName);
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
return i18n(displayName);
#else
return KLocalizedString(displayName).toString();
#endif
}
} SpecialRuleFields[] = {{"<message>", I18N_NOOP("Complete Message")},
{"<body>", I18N_NOOP("Body of Message")},
@ -50,9 +60,9 @@ static const struct {
{"<age in days>", I18N_NOOP("Age in Days")},
{"<status>", I18N_NOOP("Message Status")},
{"<tag>", I18N_NOOP("Message Tag")},
{"Subject", I18NC_NOOP("Subject of an email.", "Subject")},
{"Subject", I18N_NOOP("Subject")},
{"From", I18N_NOOP("From")},
{"To", I18NC_NOOP("Receiver of an email.", "To")},
{"To", I18N_NOOP("To")},
{"CC", I18N_NOOP("CC")},
{"Reply-To", I18N_NOOP("Reply To")},
{"Organization", I18N_NOOP("Organization")},
@ -360,14 +370,14 @@ void SearchRuleWidget::initFieldList(SearchPatternEdit::SearchPatternEditOptions
if (!notShowTags) {
mFilterFieldList.append(SpecialRuleFields[Tag].getLocalizedDisplayName());
}
mFilterFieldList.append(i18n(SpecialRuleFields[ReplyTo].displayName));
mFilterFieldList.append(i18n(SpecialRuleFields[Organization].displayName));
mFilterFieldList.append(SpecialRuleFields[ReplyTo].getLocalizedDisplayName());
mFilterFieldList.append(SpecialRuleFields[Organization].getLocalizedDisplayName());
if (!notShowDate) {
mFilterFieldList.append(i18n(SpecialRuleFields[Date].displayName));
mFilterFieldList.append(SpecialRuleFields[Date].getLocalizedDisplayName());
}
mFilterFieldList.append(i18n(SpecialRuleFields[Encryption].displayName));
mFilterFieldList.append(SpecialRuleFields[Encryption].getLocalizedDisplayName());
// these others only represent message headers and you can add to
// them as you like

@ -10,16 +10,25 @@
#include <KDateComboBox>
#include <KLocalizedString>
#include "ki18n_version.h"
#include <QComboBox>
#include <QDate>
#include <QObject>
#include <QStackedWidget>
#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0)
#include <klazylocalizedstring.h>
#undef I18N_NOOP
#define I18N_NOOP kli18n
#endif
using namespace MailCommon;
static const struct {
SearchRule::Function id;
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
const char *displayName;
#else
const KLazyLocalizedString displayName;
#endif
} DateFunctions[] = {{SearchRule::FuncEquals, I18N_NOOP("is equal to")},
{SearchRule::FuncNotEqual, I18N_NOOP("is not equal to")},
{SearchRule::FuncIsGreater, I18N_NOOP("is after")},
@ -40,7 +49,11 @@ QWidget *DateRuleWidgetHandler::createFunctionWidget(int number, QStackedWidget
funcCombo->setMinimumWidth(50);
funcCombo->setObjectName(QStringLiteral("dateRuleFuncCombo"));
for (int i = 0; i < DateFunctionCount; ++i) {
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
funcCombo->addItem(i18n(DateFunctions[i].displayName));
#else
funcCombo->addItem(KLocalizedString(DateFunctions[i].displayName).toString());
#endif
}
funcCombo->adjustSize();
QObject::connect(funcCombo, SIGNAL(activated(int)), receiver, SLOT(slotFunctionChanged()));

@ -5,15 +5,24 @@
*/
#include "encryptionwidgethandler.h"
#include "ki18n_version.h"
#include <QComboBox>
#include <QLabel>
#include <QStackedWidget>
#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0)
#include <klazylocalizedstring.h>
#undef I18N_NOOP
#define I18N_NOOP kli18n
#endif
using namespace MailCommon;
static const struct {
SearchRule::Function id;
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
const char *displayName;
#else
const KLazyLocalizedString displayName;
#endif
} EncryptionFunctions[] = {{SearchRule::FuncEquals, I18N_NOOP("is")}, {SearchRule::FuncNotEqual, I18N_NOOP("is not")}};
static const int EncryptionFunctionCount = sizeof(EncryptionFunctions) / sizeof(*EncryptionFunctions);
@ -38,7 +47,11 @@ QWidget *EncryptionWidgetHandler::createFunctionWidget(int number, QStackedWidge
combo->setMinimumWidth(50);
combo->setObjectName(QStringLiteral("encryptionRuleFuncCombo"));
for (int i = 0; i < EncryptionFunctionCount; ++i) {
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
combo->addItem(i18n(EncryptionFunctions[i].displayName));
#else
combo->addItem(KLocalizedString(EncryptionFunctions[i].displayName).toString());
#endif
}
combo->adjustSize();
QObject::connect(combo, SIGNAL(activated(int)), receiver, SLOT(slotFunctionChanged()));

@ -11,17 +11,26 @@
#include <KLineEdit>
#include <KLocalizedString>
#include "ki18n_version.h"
#include <QComboBox>
#include <QLabel>
#include <QStackedWidget>
#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0)
#include <klazylocalizedstring.h>
#undef I18N_NOOP
#define I18N_NOOP kli18n
#endif
using namespace MailCommon;
// also see SearchRule::matches() and SearchRule::Function
// if you change the following strings!
static const struct {
SearchRule::Function id;
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
const char *displayName;
#else
const KLazyLocalizedString displayName;
#endif
} HeaderFunctions[] = {{SearchRule::FuncContains, I18N_NOOP("contains")},
{SearchRule::FuncContainsNot, I18N_NOOP("does not contain")},
{SearchRule::FuncEquals, I18N_NOOP("equals")},
@ -50,7 +59,11 @@ QWidget *HeadersRuleWidgetHandler::createFunctionWidget(int number, QStackedWidg
funcCombo->setObjectName(QStringLiteral("headerRuleFuncCombo"));
for (int i = 0; i < HeadersFunctionCount; ++i) {
if (!(isBalooSearch && (HeaderFunctions[i].id == SearchRule::FuncIsInAddressbook || HeaderFunctions[i].id == SearchRule::FuncIsNotInAddressbook))) {
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
funcCombo->addItem(i18n(HeaderFunctions[i].displayName));
#else
funcCombo->addItem(KLocalizedString(HeaderFunctions[i].displayName).toString());
#endif
}
}
funcCombo->adjustSize();

@ -7,19 +7,28 @@
#include "messagerulewidgethandler.h"
#include "search/searchpattern.h"
#include "ki18n_version.h"
#include <KLineEdit>
#include <KLocalizedString>
#include <QComboBox>
#include <QLabel>
#include <QStackedWidget>
#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0)
#include <klazylocalizedstring.h>
#undef I18N_NOOP
#define I18N_NOOP kli18n
#endif
using namespace MailCommon;
// also see SearchRule::matches() and SearchRule::Function
// if you change the following strings!
static const struct {
SearchRule::Function id;
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
const char *displayName;
#else
const KLazyLocalizedString displayName;
#endif
} MessageFunctions[] = {
{SearchRule::FuncContains, I18N_NOOP("contains")},
{SearchRule::FuncContainsNot, I18N_NOOP("does not contain")},
@ -43,7 +52,11 @@ QWidget *MessageRuleWidgetHandler::createFunctionWidget(int number, QStackedWidg
funcCombo->setObjectName(QStringLiteral("messageRuleFuncCombo"));
for (int i = 0; i < MessageFunctionCount; ++i) {
if (!(isBalooSearch && (MessageFunctions[i].id == SearchRule::FuncHasAttachment || MessageFunctions[i].id == SearchRule::FuncHasNoAttachment))) {
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
funcCombo->addItem(i18n(MessageFunctions[i].displayName));
#else
funcCombo->addItem(KLocalizedString(MessageFunctions[i].displayName).toString());
#endif
}
}
funcCombo->adjustSize();

@ -9,15 +9,24 @@
#include <KLocalizedString>
#include "ki18n_version.h"
#include <QComboBox>
#include <QDoubleSpinBox>
#include <QStackedWidget>
#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0)
#include <klazylocalizedstring.h>
#undef I18N_NOOP
#define I18N_NOOP kli18n
#endif
using namespace MailCommon;
static const struct {
SearchRule::Function id;
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
const char *displayName;
#else
const KLazyLocalizedString displayName;
#endif
} NumericDoubleFunctions[] = {{SearchRule::FuncEquals, I18N_NOOP("is equal to")},
{SearchRule::FuncNotEqual, I18N_NOOP("is not equal to")},
{SearchRule::FuncIsGreater, I18N_NOOP("is greater than")},
@ -36,7 +45,11 @@ QWidget *NumericDoubleRuleWidgetHandler::createFunctionWidget(int number, QStack
funcCombo->setMinimumWidth(50);
funcCombo->setObjectName(QStringLiteral("numericDoubleRuleFuncCombo"));
for (int i = 0; i < NumericDoubleFunctionCount; ++i) {
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
funcCombo->addItem(i18n(NumericDoubleFunctions[i].displayName));
#else
funcCombo->addItem(KLocalizedString(NumericDoubleFunctions[i].displayName).toString());
#endif
}
funcCombo->adjustSize();
QObject::connect(funcCombo, SIGNAL(activated(int)), receiver, SLOT(slotFunctionChanged()));

@ -10,14 +10,23 @@
#include <KLocalizedString>
#include <KPluralHandlingSpinBox>
#include "ki18n_version.h"
#include <QComboBox>
#include <QStackedWidget>
#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0)
#include <klazylocalizedstring.h>
#undef I18N_NOOP
#define I18N_NOOP kli18n
#endif
using namespace MailCommon;
static const struct {
SearchRule::Function id;
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
const char *displayName;
#else
const KLazyLocalizedString displayName;
#endif
} NumericFunctions[] = {{SearchRule::FuncEquals, I18N_NOOP("is equal to")},
{SearchRule::FuncNotEqual, I18N_NOOP("is not equal to")},
{SearchRule::FuncIsGreater, I18N_NOOP("is greater than")},
@ -38,7 +47,11 @@ QWidget *NumericRuleWidgetHandler::createFunctionWidget(int number, QStackedWidg
funcCombo->setMinimumWidth(50);
funcCombo->setObjectName(QStringLiteral("numericRuleFuncCombo"));
for (int i = 0; i < NumericFunctionCount; ++i) {
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
funcCombo->addItem(i18n(NumericFunctions[i].displayName));
#else
funcCombo->addItem(KLocalizedString(NumericFunctions[i].displayName).toString());
#endif
}
funcCombo->adjustSize();
QObject::connect(funcCombo, SIGNAL(activated(int)), receiver, SLOT(slotFunctionChanged()));

@ -7,15 +7,24 @@
#include "statusrulewidgethandler.h"
#include "search/searchrule/searchrulestatus.h"
#include "ki18n_version.h"
#include <QComboBox>
#include <QIcon>
#include <QStackedWidget>
#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0)
#include <klazylocalizedstring.h>
#undef I18N_NOOP
#define I18N_NOOP kli18n
#endif
using namespace MailCommon;
static const struct {
SearchRule::Function id;
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
const char *displayName;
#else
const KLazyLocalizedString displayName;
#endif
} StatusFunctions[] = {{SearchRule::FuncContains, I18N_NOOP("is")}, {SearchRule::FuncContainsNot, I18N_NOOP("is not")}};
static const int StatusFunctionCount = sizeof(StatusFunctions) / sizeof(*StatusFunctions);
@ -31,7 +40,11 @@ QWidget *StatusRuleWidgetHandler::createFunctionWidget(int number, QStackedWidge
funcCombo->setMinimumWidth(50);
funcCombo->setObjectName(QStringLiteral("statusRuleFuncCombo"));
for (int i = 0; i < StatusFunctionCount; ++i) {
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
funcCombo->addItem(i18n(StatusFunctions[i].displayName));
#else
funcCombo->addItem(KLocalizedString(StatusFunctions[i].displayName).toString());
#endif
}
funcCombo->adjustSize();
QObject::connect(funcCombo, SIGNAL(activated(int)), receiver, SLOT(slotFunctionChanged()));

@ -18,10 +18,15 @@
#include <Akonadi/TagFetchJob>
#include <Akonadi/TagFetchScope>
#include "ki18n_version.h"
#include <QComboBox>
#include <QLineEdit>
#include <QStackedWidget>
#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0)
#include <klazylocalizedstring.h>
#undef I18N_NOOP
#define I18N_NOOP kli18n
#endif
using namespace MailCommon;
class FillTagComboJob : public KJob
@ -89,7 +94,11 @@ void FillTagComboJob::onTagsFetched(KJob *job)
static const struct {
SearchRule::Function id;
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
const char *displayName;
#else
const KLazyLocalizedString displayName;
#endif
} TagFunctions[] = {{SearchRule::FuncContains, I18N_NOOP("contains")},
{SearchRule::FuncContainsNot, I18N_NOOP("does not contain")},
{SearchRule::FuncEquals, I18N_NOOP("equals")},
@ -112,10 +121,18 @@ QWidget *TagRuleWidgetHandler::createFunctionWidget(int number, QStackedWidget *
for (int i = 0; i < TagFunctionCount; ++i) {
if (isBalooSearch) {
if (TagFunctions[i].id == SearchRule::FuncContains || TagFunctions[i].id == SearchRule::FuncContainsNot) {
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
funcCombo->addItem(i18n(TagFunctions[i].displayName));
#else
funcCombo->addItem(KLocalizedString(TagFunctions[i].displayName).toString());
#endif
}
} else {
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
funcCombo->addItem(i18n(TagFunctions[i].displayName));
#else
funcCombo->addItem(KLocalizedString(TagFunctions[i].displayName).toString());
#endif
}
}
funcCombo->adjustSize();

@ -14,13 +14,23 @@
using namespace MailCommon;
#include "ki18n_version.h"
#include <QLabel>
#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0)
#include <klazylocalizedstring.h>
#undef I18N_NOOP
#define I18N_NOOP kli18n
#endif
// also see SearchRule::matches() and SearchRule::Function
// if you change the following strings!
static const struct {
SearchRule::Function id;
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
const char *displayName;
#else
const KLazyLocalizedString displayName;
#endif
} TextFunctions[] = {{SearchRule::FuncContains, I18N_NOOP("contains")},
{SearchRule::FuncContainsNot, I18N_NOOP("does not contain")},
{SearchRule::FuncEquals, I18N_NOOP("equals")},
@ -46,7 +56,11 @@ QWidget *TextRuleWidgetHandler::createFunctionWidget(int number, QStackedWidget
funcCombo->setMinimumWidth(50);
funcCombo->setObjectName(QStringLiteral("textRuleFuncCombo"));
for (int i = 0; i < TextFunctionCount; ++i) {
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
funcCombo->addItem(i18n(TextFunctions[i].displayName));
#else
funcCombo->addItem(KLocalizedString(TextFunctions[i].displayName).toString());
#endif
}
funcCombo->adjustSize();
QObject::connect(funcCombo, SIGNAL(activated(int)), receiver, SLOT(slotFunctionChanged()));

Loading…
Cancel
Save