Commit c280378f authored by Laurent Montel's avatar Laurent Montel 😁

Make more strict compile

parent 3ea48398
......@@ -44,7 +44,7 @@ DebugStream::~DebugStream(){}
qint64 DebugStream::writeData(const char *data, qint64 len) {
const QByteArray buf = QByteArray::fromRawData(data, len);
// qt_message_output(QtDebugMsg, buf.trimmed().constData());
ErrorHandler::instance().addError(m_severity, buf, m_location);
ErrorHandler::instance().addError(m_severity, QString::fromLatin1(buf), m_location);
return len;
}
......@@ -53,7 +53,7 @@ QMutex mutex;
void logMessage(const QString &message, const QString &file, int line, ErrorHandler::Severity s)
{
ErrorHandler::instance().addError(s, message, file+" "+QString::number(line));
ErrorHandler::instance().addError(s, message, file+ QLatin1Char(' ') +QString::number(line));
}
ErrorHandler::ErrorHandler()
......@@ -66,7 +66,7 @@ ErrorHandler::ErrorHandler()
QDebug ErrorHandler::debugStream(ErrorHandler::Severity severity, int line, const char* file)
{
QMutexLocker locker(&mutex);
ErrorHandler::instance().m_debugStream->m_location = QString(QString(file) + "(" + QString::number(line)+")");
ErrorHandler::instance().m_debugStream->m_location = QString(QLatin1String(file) + QStringLiteral("(") + QString::number(line)+QStringLiteral(")"));
ErrorHandler::instance().m_debugStream->m_severity = severity;
return QDebug(ErrorHandler::instance().m_debugStream.data());
}
......@@ -119,13 +119,13 @@ void ErrorHandler::handleLibkolabxmlErrors()
{
switch (Kolab::error()) {
case Kolab::Warning:
instance().addError(ErrorHandler::Warning, QString::fromStdString(Kolab::errorMessage()), "libkolabxml");
instance().addError(ErrorHandler::Warning, QString::fromStdString(Kolab::errorMessage()), QStringLiteral("libkolabxml"));
break;
case Kolab::Error:
instance().addError(ErrorHandler::Error, QString::fromStdString(Kolab::errorMessage()), "libkolabxml");
instance().addError(ErrorHandler::Error, QString::fromStdString(Kolab::errorMessage()), QStringLiteral("libkolabxml"));
break;
case Kolab::Critical:
instance().addError(ErrorHandler::Critical, QString::fromStdString(Kolab::errorMessage()), "libkolabxml");
instance().addError(ErrorHandler::Critical, QString::fromStdString(Kolab::errorMessage()), QStringLiteral("libkolabxml"));
break;
default:
//Do nothing, there is no message available in this case
......
......@@ -110,7 +110,7 @@ void logMessage(const QString &,const QString &, int, ErrorHandler::Severity s);
#define LOG(message) logMessage(message,__FILE__, __LINE__, ErrorHandler::Debug);
#define WARNING(message) logMessage(message,__FILE__, __LINE__, ErrorHandler::Warning);
#define ERROR(message) logMessage(message,__FILE__, __LINE__, ErrorHandler::Error);
#define CRITICAL(message) logMessage(message,__FILE__, __LINE__, ErrorHandler::Critical);
#define CRITICAL(message) logMessage(message,QStringLiteral(__FILE__), __LINE__, ErrorHandler::Critical);
class DebugStream: public QIODevice
......
......@@ -43,8 +43,8 @@ namespace Kolab {
#define X_KOLAB_TYPE_HEADER "X-Kolab-Type"
#define X_KOLAB_MIME_VERSION_HEADER "X-Kolab-Mime-Version"
#define X_KOLAB_MIME_VERSION_HEADER_COMPAT "X-Kolab-Version"
#define KOLAB_VERSION_V2 "2.0"
#define KOLAB_VERSION_V3 "3.0"
#define KOLAB_VERSION_V2 QStringLiteral("2.0")
#define KOLAB_VERSION_V3 QStringLiteral("3.0")
#define KOLAB_OBJECT_FILENAME "kolab.xml"
......
......@@ -299,7 +299,7 @@ QVariant MIMEObject::Private::readKolabV2(const KMime::Message::Ptr &msg, Kolab:
break;
}
default:
CRITICAL("no kolab object found ");
CRITICAL(QStringLiteral("no kolab object found "));
break;
}
if (ErrorHandler::errorOccured()) {
......@@ -450,7 +450,7 @@ void MIMEObject::setVersion(Version version)
static std::string createCid()
{
return QString::fromLatin1("cid:%1@%2").arg(KRandom::randomString(16)).arg("kolab.resource.akonadi").toStdString();
return QString::fromLatin1("cid:%1@%2").arg(KRandom::randomString(16)).arg(QString::fromLatin1("kolab.resource.akonadi")).toStdString();
}
std::vector<Kolab::Attachment> convertToReferences(const std::vector<Kolab::Attachment> &attachments, std::vector<std::string> &attachmentCids)
......@@ -481,7 +481,7 @@ static void addAttachments(KMime::Message::Ptr msg, const std::vector<Attachment
foreach (const Attachment &attachment, attachments) {
const std::string data = attachment.data();
const std::string cid = attachmentCids.empty() ? attachment.uri() : attachmentCids.at(index);
msg->addContent(Mime::createAttachmentPart(Mime::fromCid(QByteArray(cid.c_str())).toLatin1(), QByteArray(attachment.mimetype().c_str()), QString::fromStdString(attachment.label()), QByteArray::fromRawData(data.c_str(), data.size())));
msg->addContent(Mime::createAttachmentPart(Mime::fromCid(QString::fromStdString(cid.c_str())).toLatin1(), QByteArray(attachment.mimetype().c_str()), QString::fromStdString(attachment.label()), QByteArray::fromRawData(data.c_str(), data.size())));
index++;
}
}
......
......@@ -115,12 +115,12 @@ KContacts::Addressee addresseeFromKolab( const QByteArray &xmlData, const KMime:
const QString &pictureAttachmentName = contact.pictureAttachmentName();
if (!pictureAttachmentName.isEmpty()) {
const QImage &img = getPicture(pictureAttachmentName, data, type);
contact.setPicture(img, type);
contact.setPicture(img, QString::fromLatin1(type));
}
const QString &logoAttachmentName = contact.logoAttachmentName();
if (!logoAttachmentName.isEmpty()) {
contact.setLogo(getPicture(logoAttachmentName, data, type), type);
contact.setLogo(getPicture(logoAttachmentName, data, type), QString::fromLatin1(type));
}
const QString &soundAttachmentName = contact.soundAttachmentName();
......@@ -154,7 +154,7 @@ static QByteArray createPicture(const QImage &img, const QString &/*format*/, QS
QByteArray pic;
QBuffer buffer(&pic);
buffer.open(QIODevice::WriteOnly);
type = "image/png";
type = QStringLiteral("image/png");
//FIXME it's not possible to save jpegs lossless, so we always use png. otherwise we would compress the image on every write.
// if (format == "image/jpeg") {
// type = "image/jpeg";
......@@ -231,15 +231,15 @@ KMime::Message::Ptr distListToKolabFormat(const KolabV2::DistributionList& distL
KMime::Message::Ptr noteFromKolab(const QByteArray &xmlData, const KDateTime &creationDate)
{
KolabV2::Note j;
if ( !j.load( xmlData ) ) {
if ( !j.load( QString::fromUtf8(xmlData) ) ) {
Warning() << "failed to read note";
return KMime::Message::Ptr();
}
Akonadi::NoteUtils::NoteMessageWrapper note;
note.setTitle(j.summary());
note.setText(j.body().toUtf8());
note.setFrom("kolab@kde4");
note.setText(j.body());
note.setFrom(QStringLiteral("kolab@kde4"));
note.setCreationDate(creationDate.dateTime());
return note.message();
}
......@@ -251,7 +251,7 @@ KMime::Message::Ptr noteToKolab(const KMime::Message::Ptr& msg, const QString &p
return KMime::Message::Ptr();
}
Akonadi::NoteUtils::NoteMessageWrapper note(msg);
return Mime::createMessage(note.title(), KOLAB_TYPE_NOTE, KOLAB_TYPE_NOTE, noteToKolabXML(msg), false, productId);
return Mime::createMessage(note.title(), QLatin1String(KOLAB_TYPE_NOTE), QLatin1String(KOLAB_TYPE_NOTE), noteToKolabXML(msg), false, productId);
}
QByteArray noteToKolabXML(const KMime::Message::Ptr& msg)
......@@ -278,7 +278,7 @@ QStringList readLegacyDictionaryConfiguration(const QByteArray &xmlData, QString
QDomElement top = xmlDoc.documentElement();
if ( top.tagName() != "configuration" ) {
if ( top.tagName() != QLatin1String("configuration") ) {
qWarning( "XML error: Top tag was %s instead of the expected configuration",
top.tagName().toAscii().data() );
return QStringList();
......@@ -288,9 +288,9 @@ QStringList readLegacyDictionaryConfiguration(const QByteArray &xmlData, QString
if ( n.isComment() || !n.isElement() )
continue;
QDomElement e = n.toElement();
if (e.tagName() == "language") {
if (e.tagName() == QLatin1String("language")) {
language = e.text();
} else if (e.tagName() == "e") {
} else if (e.tagName() == QLatin1String("e")) {
dictionary.append(e.text());
}
}
......
......@@ -73,7 +73,7 @@ public:
void saveTo( KContacts::Addressee* address );
QString type() const override { return "Contact"; }
QString type() const override { return QStringLiteral("Contact"); }
void setGivenName( const QString& name );
QString givenName() const;
......
......@@ -48,7 +48,7 @@ public:
void saveTo( KContacts::ContactGroup* contactGroup );
QString type() const override { return "DistributionList"; }
QString type() const override { return QStringLiteral("DistributionList"); }
void setName( const QString& name );
QString name() const;
......
......@@ -65,7 +65,7 @@ public:
void saveTo( const KCalCore::Event::Ptr &event );
QString type() const override { return "Event"; }
QString type() const override { return QStringLiteral("Event"); }
virtual void setTransparency( KCalCore::Event::Transparency transparency );
virtual KCalCore::Event::Transparency transparency() const;
......
......@@ -105,7 +105,7 @@ public:
QList<Attendee>& attendees();
const QList<Attendee>& attendees() const;
QString type() const override { return "Incidence"; }
QString type() const override { return QStringLiteral("Incidence"); }
/**
* The internal uid is used as the uid inside KOrganizer whenever
* two or more events with the same uid appear, which KOrganizer
......
......@@ -60,7 +60,7 @@ public:
explicit Journal( const QString& tz, const KCalCore::Journal::Ptr &journal = KCalCore::Journal::Ptr() );
virtual ~Journal();
QString type() const override { return "Journal"; }
QString type() const override { return QStringLiteral("Journal"); }
void saveTo( const KCalCore::Journal::Ptr &journal );
......
......@@ -147,7 +147,7 @@ protected:
bool loadEmailAttribute( QDomElement& element, Email& email );
void saveEmailAttribute( QDomElement& element, const Email& email,
const QString& tagName = "email" ) const;
const QString& tagName = QStringLiteral("email") ) const;
// Load the attributes of this class
virtual bool loadAttribute( QDomElement& );
......
......@@ -63,7 +63,7 @@ public:
void saveTo( const KCalCore::Journal::Ptr &journal );
QString type() const override { return "Note"; }
QString type() const override { return QStringLiteral("Note"); }
virtual void setSummary( const QString& summary );
virtual QString summary() const;
......
......@@ -67,7 +67,7 @@ public:
const QString& tz, const KCalCore::Todo::Ptr &todo = KCalCore::Todo::Ptr() );
virtual ~Task();
QString type() const override { return "Task"; }
QString type() const override { return QStringLiteral("Task"); }
void saveTo( const KCalCore::Todo::Ptr &todo );
......
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