summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2017-09-28 13:56:43 +0200
committerMontel Laurent <[email protected]>2017-09-28 13:56:43 +0200
commitc280378fb5069a14d04aea73370d7279472f1ef9 (patch)
tree297df144b6d09c37f6a5514d9877c5bf5ec4745c
parent3ea483984a11ea71e98edd1b8b4f95941ec6a4a7 (diff)
Make more strict compile
-rw-r--r--resources/kolab/libkolab/kolabformat/errorhandler.cpp12
-rw-r--r--resources/kolab/libkolab/kolabformat/errorhandler.h2
-rw-r--r--resources/kolab/libkolab/kolabformat/kolabdefinitions.h4
-rw-r--r--resources/kolab/libkolab/kolabformat/mimeobject.cpp6
-rw-r--r--resources/kolab/libkolab/kolabformat/v2helpers.cpp20
-rw-r--r--resources/kolab/libkolab/kolabformatV2/contact.h2
-rw-r--r--resources/kolab/libkolab/kolabformatV2/distributionlist.h2
-rw-r--r--resources/kolab/libkolab/kolabformatV2/event.h2
-rw-r--r--resources/kolab/libkolab/kolabformatV2/incidence.h2
-rw-r--r--resources/kolab/libkolab/kolabformatV2/journal.h2
-rw-r--r--resources/kolab/libkolab/kolabformatV2/kolabbase.h2
-rw-r--r--resources/kolab/libkolab/kolabformatV2/note.h2
-rw-r--r--resources/kolab/libkolab/kolabformatV2/task.h2
13 files changed, 30 insertions, 30 deletions
diff --git a/resources/kolab/libkolab/kolabformat/errorhandler.cpp b/resources/kolab/libkolab/kolabformat/errorhandler.cpp
index 3f8a738..ee3ba07 100644
--- a/resources/kolab/libkolab/kolabformat/errorhandler.cpp
+++ b/resources/kolab/libkolab/kolabformat/errorhandler.cpp
@@ -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
diff --git a/resources/kolab/libkolab/kolabformat/errorhandler.h b/resources/kolab/libkolab/kolabformat/errorhandler.h
index ba667c9..6ee4a42 100644
--- a/resources/kolab/libkolab/kolabformat/errorhandler.h
+++ b/resources/kolab/libkolab/kolabformat/errorhandler.h
@@ -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
diff --git a/resources/kolab/libkolab/kolabformat/kolabdefinitions.h b/resources/kolab/libkolab/kolabformat/kolabdefinitions.h
index e1d8e93..9381e04 100644
--- a/resources/kolab/libkolab/kolabformat/kolabdefinitions.h
+++ b/resources/kolab/libkolab/kolabformat/kolabdefinitions.h
@@ -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"
diff --git a/resources/kolab/libkolab/kolabformat/mimeobject.cpp b/resources/kolab/libkolab/kolabformat/mimeobject.cpp
index a1034e1..660a91f 100644
--- a/resources/kolab/libkolab/kolabformat/mimeobject.cpp
+++ b/resources/kolab/libkolab/kolabformat/mimeobject.cpp
@@ -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:%[email protected]%2").arg(KRandom::randomString(16)).arg("kolab.resource.akonadi").toStdString();
+ return QString::fromLatin1("cid:%[email protected]%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++;
}
}
diff --git a/resources/kolab/libkolab/kolabformat/v2helpers.cpp b/resources/kolab/libkolab/kolabformat/v2helpers.cpp
index 1a84c86..94dda23 100644
--- a/resources/kolab/libkolab/kolabformat/v2helpers.cpp
+++ b/resources/kolab/libkolab/kolabformat/v2helpers.cpp
@@ -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("[email protected]");
+ note.setText(j.body());
+ note.setFrom(QStringLiteral("[email protected]"));
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());
}
}
diff --git a/resources/kolab/libkolab/kolabformatV2/contact.h b/resources/kolab/libkolab/kolabformatV2/contact.h
index 6f76d6f..43fa116 100644
--- a/resources/kolab/libkolab/kolabformatV2/contact.h
+++ b/resources/kolab/libkolab/kolabformatV2/contact.h
@@ -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;
diff --git a/resources/kolab/libkolab/kolabformatV2/distributionlist.h b/resources/kolab/libkolab/kolabformatV2/distributionlist.h
index 11e8e1a..f20b283 100644
--- a/resources/kolab/libkolab/kolabformatV2/distributionlist.h
+++ b/resources/kolab/libkolab/kolabformatV2/distributionlist.h
@@ -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;
diff --git a/resources/kolab/libkolab/kolabformatV2/event.h b/resources/kolab/libkolab/kolabformatV2/event.h
index 2df8026..b278c28 100644
--- a/resources/kolab/libkolab/kolabformatV2/event.h
+++ b/resources/kolab/libkolab/kolabformatV2/event.h
@@ -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;
diff --git a/resources/kolab/libkolab/kolabformatV2/incidence.h b/resources/kolab/libkolab/kolabformatV2/incidence.h
index 65936b6..8ae13bf 100644
--- a/resources/kolab/libkolab/kolabformatV2/incidence.h
+++ b/resources/kolab/libkolab/kolabformatV2/incidence.h
@@ -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
diff --git a/resources/kolab/libkolab/kolabformatV2/journal.h b/resources/kolab/libkolab/kolabformatV2/journal.h
index da2a8e6..a0633f9 100644
--- a/resources/kolab/libkolab/kolabformatV2/journal.h
+++ b/resources/kolab/libkolab/kolabformatV2/journal.h
@@ -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 );
diff --git a/resources/kolab/libkolab/kolabformatV2/kolabbase.h b/resources/kolab/libkolab/kolabformatV2/kolabbase.h
index 001e1c6..be47959 100644
--- a/resources/kolab/libkolab/kolabformatV2/kolabbase.h
+++ b/resources/kolab/libkolab/kolabformatV2/kolabbase.h
@@ -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& );
diff --git a/resources/kolab/libkolab/kolabformatV2/note.h b/resources/kolab/libkolab/kolabformatV2/note.h
index 6cddb05..5d15a44 100644
--- a/resources/kolab/libkolab/kolabformatV2/note.h
+++ b/resources/kolab/libkolab/kolabformatV2/note.h
@@ -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;
diff --git a/resources/kolab/libkolab/kolabformatV2/task.h b/resources/kolab/libkolab/kolabformatV2/task.h
index 872a2d2..169c69c 100644
--- a/resources/kolab/libkolab/kolabformatV2/task.h
+++ b/resources/kolab/libkolab/kolabformatV2/task.h
@@ -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 );