Commit f9d5ba42 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Make it compile without deprecated methods

parent 023d2958
Pipeline #98404 passed with stage
in 14 minutes and 35 seconds
......@@ -165,7 +165,7 @@ include_directories(
add_definitions(-D_ASSUAN_ONLY_GPG_ERRORS)
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050e00)
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x055800)
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x055900)
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-missing-braces -Wno-parentheses -Wno-ignored-qualifiers")
endif()
......
......@@ -15,21 +15,31 @@
#include <Libkleo/GnuPG>
#include <KLocalizedString>
#include "ki18n_version.h"
#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0)
#include <klazylocalizedstring.h>
#undef I18N_NOOP
#define I18N_NOOP kli18n
#endif
static const char kleopatra_version[] = KLEOPATRA_VERSION_STRING;
struct about_data {
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
const char *name;
const char *desc;
#else
const KLazyLocalizedString name;
const KLazyLocalizedString desc;
#endif
const char *email;
const char *web;
};
static const about_data authors[] = {
{ "Andre Heinecke", I18N_NOOP("Current Maintainer"), "aheinecke@gnupg.org", nullptr },
{ "Marc Mutz", I18N_NOOP("Former Maintainer"), "mutz@kde.org", nullptr },
{ "Steffen Hansen", I18N_NOOP("Former Maintainer"), "hansen@kde.org", nullptr },
{ "Matthias Kalle Dalheimer", I18N_NOOP("Original Author"), "kalle@kde.org", nullptr },
{ I18N_NOOP("Andre Heinecke"), I18N_NOOP("Current Maintainer"), "aheinecke@gnupg.org", nullptr },
{ I18N_NOOP("Marc Mutz"), I18N_NOOP("Former Maintainer"), "mutz@kde.org", nullptr },
{ I18N_NOOP("Steffen Hansen"), I18N_NOOP("Former Maintainer"), "hansen@kde.org", nullptr },
{ I18N_NOOP("Matthias Kalle Dalheimer"), I18N_NOOP("Original Author"), "kalle@kde.org", nullptr },
};
static const about_data credits[] = {
......@@ -85,6 +95,7 @@ AboutData::AboutData()
{
using ::authors;
using ::credits;
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
for (unsigned int i = 0; i < sizeof authors / sizeof * authors; ++i) {
addAuthor(i18n(authors[i].name), i18n(authors[i].desc),
QLatin1String(authors[i].email), QLatin1String(authors[i].web));
......@@ -93,6 +104,17 @@ AboutData::AboutData()
addCredit(i18n(credits[i].name), i18n(credits[i].desc),
QLatin1String(credits[i].email), QLatin1String(credits[i].web));
}
#else
for (unsigned int i = 0; i < sizeof authors / sizeof * authors; ++i) {
addAuthor(KLocalizedString(authors[i].name).toString(), KLocalizedString(authors[i].desc).toString(),
QLatin1String(authors[i].email), QLatin1String(authors[i].web));
}
for (unsigned int i = 0; i < sizeof credits / sizeof * credits; ++i) {
addCredit(KLocalizedString(credits[i].name).toString(), KLocalizedString(credits[i].desc).toString(),
QLatin1String(credits[i].email), QLatin1String(credits[i].web));
}
#endif
const auto backendVersions = Kleo::backendVersionInfo();
if (!backendVersions.empty()) {
......
......@@ -33,7 +33,15 @@
#include <algorithm>
#include <vector>
#include "ki18n_version.h"
#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0)
#include <klazylocalizedstring.h>
#undef I18N_NOOP
#define I18N_NOOP kli18n
#define I18N_NOOP_EMPTY KLazyLocalizedString()
#else
#define I18N_NOOP_EMPTY ""
#endif
using namespace GpgME;
using namespace Kleo;
using namespace Kleo::Dialogs;
......@@ -143,7 +151,11 @@ enum Action { Nothing = 0, Failure = 1, ClearCMS = 2, ClearPGP = 4 };
// cms.empty() << 1U | d->canDelete( CMS ) << 0U ;
static const struct {
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
const char *text;
#else
const KLazyLocalizedString text;
#endif
Action actions;
} deletionErrorCases[16] = {
// if havePGP
......@@ -187,16 +199,16 @@ static const struct {
ClearCMS
}, // cantCMS
{
nullptr,
I18N_NOOP_EMPTY,
Nothing
}, // canCMS
// if !haveCMS
{
nullptr,
I18N_NOOP_EMPTY,
Nothing
}, // cantCMS
{
nullptr,
I18N_NOOP_EMPTY,
Nothing
}, // canCMS
// if !havePGP
......@@ -209,16 +221,16 @@ static const struct {
Failure
}, // cantCMS
{
nullptr,
I18N_NOOP_EMPTY,
Nothing
}, // canCMS
// if !haveCMS
{
nullptr,
I18N_NOOP_EMPTY,
Nothing
}, // cantCMS
{
nullptr,
I18N_NOOP_EMPTY,
Nothing
}, // canCMS
// if canPGP
......@@ -230,16 +242,16 @@ static const struct {
Failure
}, // cantCMS
{
nullptr,
I18N_NOOP_EMPTY,
Nothing
}, // canCMS
// if !haveCMS
{
nullptr,
I18N_NOOP_EMPTY,
Nothing
}, // cantCMS
{
nullptr,
I18N_NOOP_EMPTY,
Nothing
}, // canCMS
};
......@@ -299,10 +311,19 @@ void DeleteCertificatesCommand::Private::slotDialogAccepted()
cms.empty() << 1U | canDelete(CMS) << 0U;
if (const unsigned int actions = deletionErrorCases[errorCase].actions) {
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
information(i18n(deletionErrorCases[errorCase].text),
(actions & Failure)
? i18n("Certificate Deletion Failed")
: i18n("Certificate Deletion Problem"));
? i18n("Certificate Deletion Failed")
: i18n("Certificate Deletion Problem"));
#else
information(KLocalizedString(deletionErrorCases[errorCase].text).toString(),
(actions & Failure)
? i18n("Certificate Deletion Failed")
: i18n("Certificate Deletion Problem"));
#endif
if (actions & ClearCMS) {
cms.clear();
}
......
......@@ -12,10 +12,21 @@
#include <KLocalizedString>
#include "ki18n_version.h"
#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0)
#include <klazylocalizedstring.h>
#undef I18N_NOOP
#define I18N_NOOP kli18n
#endif
struct about_data {
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
const char *name;
const char *desc;
#else
const KLazyLocalizedString name;
const KLazyLocalizedString desc;
#endif
const char *email;
const char *web;
};
......@@ -31,7 +42,13 @@ AboutData::AboutData()
{
using ::authors;
//using ::credits;
for (unsigned int i = 0; i < sizeof authors / sizeof * authors; ++i)
for (unsigned int i = 0; i < sizeof authors / sizeof * authors; ++i) {
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
addAuthor(i18n(authors[i].name), i18n(authors[i].desc),
QLatin1String(authors[i].email), QLatin1String(authors[i].web));
#else
addAuthor(KLocalizedString(authors[i].name).toString(), KLocalizedString(authors[i].desc).toString(),
QLatin1String(authors[i].email), QLatin1String(authors[i].web));
#endif
}
}
Markdown is supported
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