Commit 1e07ed31 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Make it compile without deprecated methods

parent 7f439ad7
Pipeline #98401 passed with stage
in 5 minutes and 51 seconds
......@@ -18,7 +18,13 @@
#include <KFormat>
#include <QLocale>
#include "ki18n_version.h"
#include <array>
#if KI18N_VERSION >= QT_VERSION_CHECK(5, 89, 0)
#include <klazylocalizedstring.h>
#undef I18NC_NOOP
#define I18NC_NOOP kli18nc
#endif
using MessagePtr = KMime::Message::Ptr;
......@@ -27,8 +33,12 @@ using namespace Akonadi;
namespace
{
struct HeaderName {
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
const char *desc;
const char *name;
#else
const KLazyLocalizedString desc;
#endif
};
constexpr std::array<HeaderName, 5> headers = {{{I18NC_NOOP("@title:column, message (e.g. email) subject", "Subject")},
{I18NC_NOOP("@title:column, sender of message (e.g. email)", "Sender")},
......@@ -120,7 +130,11 @@ QVariant MessageModel::entityData(const Item &item, int column, int role) const
QVariant MessageModel::entityHeaderData(int section, Qt::Orientation orientation, int role, HeaderGroup headerGroup) const
{
if (section >= 0 && static_cast<std::size_t>(section) < headers.size()) {
#if KI18N_VERSION < QT_VERSION_CHECK(5, 89, 0)
return i18nc(headers[section].desc, headers[section].name);
#else
return KLocalizedString(headers[section].desc).toString();
#endif
}
return EntityTreeModel::entityHeaderData(section, orientation, role, headerGroup);
......
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