Commit 3900571c authored by Laurent Montel's avatar Laurent Montel 😁

Make it compiles with QT_NO_CAST_FROM_BYTEARRAY

parent b9aed567
project(messagecomposer)
remove_definitions( -DQT_NO_CAST_FROM_BYTEARRAY )
ecm_setup_version(${MESSAGELIB_LIB_VERSION} VARIABLE_PREFIX MESSAGECOMPOSER
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/messagecomposer_version.h"
......
......@@ -429,13 +429,13 @@ void MessageFactoryTest::test_multipartAlternative_data()
QDir dir(QStringLiteral(MAIL_DATA_DIR));
foreach (const QString &file, dir.entryList(QStringList(QLatin1String("plain_message.mbox")), QDir::Files | QDir::Readable | QDir::NoSymLinks)) {
QTest::newRow(file.toLatin1()) << QString(dir.path() + QLatin1Char('/') + file) << 0 << "" <<
QTest::newRow(file.toLatin1().constData()) << QString(dir.path() + QLatin1Char('/') + file) << 0 << "" <<
"> This *is* the *message* text *from* Sudhendu Kumar<dontspamme@yoohoo.com>\n"
"> \n"
"> --\n"
"> Thanks & Regards\n"
"> Sudhendu Kumar";
QTest::newRow(file.toLatin1()) << QString(dir.path() + QLatin1Char('/') + file) << 1 << "" << "<html><head></head><body>"
QTest::newRow(file.toLatin1().constData()) << QString(dir.path() + QLatin1Char('/') + file) << 1 << "" << "<html><head></head><body>"
"<blockquote>This <i>is</i> the <b>message</b> text <u>from</u> Sudhendu Kumar&lt;dontspamme@yoohoo.com&gt;<br>"
"<br>-- <br>Thanks &amp; Regards<br>Sudhendu Kumar<br>\n</blockquote><br/></body></html>";
}
......
......@@ -31,7 +31,7 @@
void MessageComposer::Test::setupEnv()
{
setenv("LC_ALL", "C", 1);
setenv("KDEHOME", QFile::encodeName(QDir::homePath() + QString::fromLatin1("/.qttest")), 1);
setenv("KDEHOME", QFile::encodeName(QDir::homePath() + QString::fromLatin1("/.qttest")).constData(), 1);
QStringList reasons;
Kleo::CryptoBackendFactory::instance()->scanForBackends(&reasons);
......
......@@ -948,7 +948,7 @@ void MessageComposer::ComposerViewBase::queueMessage(const KMime::Message::Ptr &
QMapIterator<QByteArray, QString> customHeader(m_customHeader);
while (customHeader.hasNext()) {
customHeader.next();
auto header = new KMime::Headers::Generic(customHeader.key());
auto header = new KMime::Headers::Generic(customHeader.key().constData());
header->fromUnicodeString(customHeader.value(), "utf-8");
message->setHeader(header);
}
......
......@@ -957,7 +957,7 @@ QString MessageFactory::replaceHeadersInString(const KMime::Message::Ptr &msg, c
idx = 0;
while ((idx = rx.indexIn(result, idx)) != -1) {
QString replacement = msg->headerByType(rx.cap(1).toLatin1()) ? msg->headerByType(rx.cap(1).toLatin1())->asUnicodeString() : QStringLiteral("");
QString replacement = msg->headerByType(rx.cap(1).toLatin1().constData()) ? msg->headerByType(rx.cap(1).toLatin1().constData())->asUnicodeString() : QStringLiteral("");
result.replace(idx, rx.matchedLength(), replacement);
idx += replacement.length();
}
......
......@@ -167,12 +167,12 @@ void applyIdentity(const KMime::Message::Ptr &message, const KIdentityManagement
KMime::Types::AddrSpecList extractAddrSpecs(const KMime::Message::Ptr &msg, const QByteArray &header)
{
KMime::Types::AddrSpecList result;
if (!msg->headerByType(header)) {
if (!msg->headerByType(header.constData())) {
return result;
}
KMime::Types::AddressList al =
MessageCore::StringUtil::splitAddressField(msg->headerByType(header)->asUnicodeString().toUtf8());
MessageCore::StringUtil::splitAddressField(msg->headerByType(header.constData())->asUnicodeString().toUtf8());
KMime::Types::AddressList::const_iterator alend(al.constEnd());
for (KMime::Types::AddressList::const_iterator ait = al.constBegin(); ait != alend; ++ait) {
KMime::Types::MailboxList::const_iterator mitEnd((*ait).mailboxList.constEnd());
......
......@@ -117,7 +117,7 @@ bool ImageScaling::resizeImage()
format = "PNG";
}
}
const bool result = d->mImage.save(&d->mBuffer, format);
const bool result = d->mImage.save(&d->mBuffer, format.constData());
d->mBuffer.close();
return result;
} else {
......
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