diff --git a/CMakeLists.txt b/CMakeLists.txt index 0365fb5..1abd294 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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") diff --git a/src/search/searchpatternedit.cpp b/src/search/searchpatternedit.cpp index cb39b60..246bf1c 100644 --- a/src/search/searchpatternedit.cpp +++ b/src/search/searchpatternedit.cpp @@ -10,6 +10,7 @@ using MailCommon::RuleWidgetHandlerManager; #include "mailcommon_debug.h" +#include "ki18n_version.h" #include #include #include @@ -21,26 +22,35 @@ using MailCommon::RuleWidgetHandlerManager; #include #include #include - +#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0) +#include +#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[] = {{"", I18N_NOOP("Complete Message")}, {"", I18N_NOOP("Body of Message")}, @@ -50,9 +60,9 @@ static const struct { {"", I18N_NOOP("Age in Days")}, {"", I18N_NOOP("Message Status")}, {"", 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 diff --git a/src/search/widgethandler/daterulewidgethandler.cpp b/src/search/widgethandler/daterulewidgethandler.cpp index 5e18009..76c6903 100644 --- a/src/search/widgethandler/daterulewidgethandler.cpp +++ b/src/search/widgethandler/daterulewidgethandler.cpp @@ -10,16 +10,25 @@ #include #include +#include "ki18n_version.h" #include #include #include #include - +#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0) +#include +#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())); diff --git a/src/search/widgethandler/encryptionwidgethandler.cpp b/src/search/widgethandler/encryptionwidgethandler.cpp index c005415..5a68d7c 100644 --- a/src/search/widgethandler/encryptionwidgethandler.cpp +++ b/src/search/widgethandler/encryptionwidgethandler.cpp @@ -5,15 +5,24 @@ */ #include "encryptionwidgethandler.h" +#include "ki18n_version.h" #include #include #include - +#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0) +#include +#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())); diff --git a/src/search/widgethandler/headersrulerwidgethandler.cpp b/src/search/widgethandler/headersrulerwidgethandler.cpp index 2199341..807f80c 100644 --- a/src/search/widgethandler/headersrulerwidgethandler.cpp +++ b/src/search/widgethandler/headersrulerwidgethandler.cpp @@ -11,17 +11,26 @@ #include #include +#include "ki18n_version.h" #include #include #include - +#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0) +#include +#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(); diff --git a/src/search/widgethandler/messagerulewidgethandler.cpp b/src/search/widgethandler/messagerulewidgethandler.cpp index de3dd0d..c393b98 100644 --- a/src/search/widgethandler/messagerulewidgethandler.cpp +++ b/src/search/widgethandler/messagerulewidgethandler.cpp @@ -7,19 +7,28 @@ #include "messagerulewidgethandler.h" #include "search/searchpattern.h" +#include "ki18n_version.h" #include #include #include #include #include - +#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0) +#include +#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(); diff --git a/src/search/widgethandler/numericdoublerulewidgethandler.cpp b/src/search/widgethandler/numericdoublerulewidgethandler.cpp index e29c09e..4b9d1a3 100644 --- a/src/search/widgethandler/numericdoublerulewidgethandler.cpp +++ b/src/search/widgethandler/numericdoublerulewidgethandler.cpp @@ -9,15 +9,24 @@ #include +#include "ki18n_version.h" #include #include #include - +#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0) +#include +#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())); diff --git a/src/search/widgethandler/numericrulewidgethandler.cpp b/src/search/widgethandler/numericrulewidgethandler.cpp index 7edf55c..ea43fcf 100644 --- a/src/search/widgethandler/numericrulewidgethandler.cpp +++ b/src/search/widgethandler/numericrulewidgethandler.cpp @@ -10,14 +10,23 @@ #include #include +#include "ki18n_version.h" #include #include - +#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0) +#include +#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())); diff --git a/src/search/widgethandler/statusrulewidgethandler.cpp b/src/search/widgethandler/statusrulewidgethandler.cpp index 910fc89..232939b 100644 --- a/src/search/widgethandler/statusrulewidgethandler.cpp +++ b/src/search/widgethandler/statusrulewidgethandler.cpp @@ -7,15 +7,24 @@ #include "statusrulewidgethandler.h" #include "search/searchrule/searchrulestatus.h" +#include "ki18n_version.h" #include #include #include - +#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0) +#include +#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())); diff --git a/src/search/widgethandler/tagrulewidgethandler.cpp b/src/search/widgethandler/tagrulewidgethandler.cpp index 0c21107..f303364 100644 --- a/src/search/widgethandler/tagrulewidgethandler.cpp +++ b/src/search/widgethandler/tagrulewidgethandler.cpp @@ -18,10 +18,15 @@ #include #include +#include "ki18n_version.h" #include #include #include - +#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0) +#include +#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(); diff --git a/src/search/widgethandler/textrulerwidgethandler.cpp b/src/search/widgethandler/textrulerwidgethandler.cpp index 80373e4..48566c1 100644 --- a/src/search/widgethandler/textrulerwidgethandler.cpp +++ b/src/search/widgethandler/textrulerwidgethandler.cpp @@ -14,13 +14,23 @@ using namespace MailCommon; +#include "ki18n_version.h" #include +#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0) +#include +#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()));