Commit 9cbca27d authored by Laurent Montel's avatar Laurent Montel 😁

Fix clazy warning

parent dc6ffdfe
......@@ -38,7 +38,7 @@ NewMailNotifierShowMessageJob::~NewMailNotifierShowMessageJob()
void NewMailNotifierShowMessageJob::start()
{
if (mId < 0) {
Q_EMIT emitResult();
emitResult();
return;
}
const QString kmailInterface = QStringLiteral("org.kde.kmail");
......@@ -49,7 +49,7 @@ void NewMailNotifierShowMessageJob::start()
if (KToolInvocation::startServiceByDesktopName(QStringLiteral("org.kde.kmail2"), QString(), &errmsg)) {
qCDebug(NEWMAILNOTIFIER_LOG) << " Can not start kmail" << errmsg;
setError(UserDefinedError);
Q_EMIT emitResult();
emitResult();
return;
}
}
......@@ -57,5 +57,5 @@ void NewMailNotifierShowMessageJob::start()
if (kmail.isValid()) {
kmail.call(QStringLiteral("showMail"), mId);
}
Q_EMIT emitResult();
emitResult();
}
......@@ -37,6 +37,10 @@ public:
InfoDialog(bool closeWhenDone = true);
~InfoDialog();
static bool hasError()
{
return mError;
}
public Q_SLOTS:
void message(KMigratorBase::MessageType type, const QString &msg);
void message(MigratorBase::MessageType type, const QString &msg);
......@@ -44,14 +48,6 @@ public Q_SLOTS:
void migratorAdded();
void migratorDone();
static bool hasError()
{
return mError;
}
bool hasChange() const
{
return mChange;
}
void status(const QString &msg);
......@@ -59,6 +55,10 @@ public Q_SLOTS:
void progress(int min, int max, int value);
private:
bool hasChange() const
{
return mChange;
}
void scrollBarMoved(int value);
QEventLoopLocker eventLoopLocker;
QDialogButtonBox *mButtonBox = nullptr;
......
......@@ -48,42 +48,42 @@ void MailSerializerTest::testEnvelopeDeserialize_data()
<< 1
<< QByteArray("(\"Wed, 1 Feb 2006 13:37:19 UT\" \"IMPORTANT: Akonadi Test\" ((\"Tobias Koenig\" NIL \"tokoe\" \"kde.org\")) ((\"Tobias Koenig\" NIL \"tokoe\" \"kde.org\")) NIL ((\"Ingo Kloecker\" NIL \"kloecker\" \"kde.org\")) NIL NIL NIL <{7b55527e-77f4-489d-bf18-e805be96718c}@server.kde.org>)")
<< QDateTime(QDate(2006, 2, 1), QTime(13, 37, 19), Qt::UTC)
<< QString::fromUtf8("IMPORTANT: Akonadi Test")
<< QString::fromUtf8("Tobias Koenig <tokoe@kde.org>")
<< QString::fromUtf8("Tobias Koenig <tokoe@kde.org>")
<< QStringLiteral("IMPORTANT: Akonadi Test")
<< QStringLiteral("Tobias Koenig <tokoe@kde.org>")
<< QStringLiteral("Tobias Koenig <tokoe@kde.org>")
<< QString()
<< QString::fromUtf8("Ingo Kloecker <kloecker@kde.org>")
<< QStringLiteral("Ingo Kloecker <kloecker@kde.org>")
<< QString() << QString() << QString()
<< QString::fromUtf8("<{7b55527e-77f4-489d-bf18-e805be96718c}@server.kde.org>")
<< QStringLiteral("<{7b55527e-77f4-489d-bf18-e805be96718c}@server.kde.org>")
<< QString();
QTest::newRow("v1 - with references")
<< 1
<< QByteArray("(\"Wed, 1 Feb 2006 13:37:19 UT\" \"IMPORTANT: Akonadi Test\" ((\"Tobias Koenig\" NIL \"tokoe\" \"kde.org\")) ((\"Tobias Koenig\" NIL \"tokoe\" \"kde.org\")) NIL ((\"Ingo Kloecker\" NIL \"kloecker\" \"kde.org\")) NIL NIL NIL <{7b55527e-77f4-489d-bf18-e805be96718c}@server.kde.org> \"<{8888827e-77f4-489d-bf18-e805be96718c}@server.kde.org> <{9999927e-77f4-489d-bf18-e805be96718c}@server.kde.org>\")")
<< QDateTime(QDate(2006, 2, 1), QTime(13, 37, 19), Qt::UTC)
<< QString::fromUtf8("IMPORTANT: Akonadi Test")
<< QString::fromUtf8("Tobias Koenig <tokoe@kde.org>")
<< QString::fromUtf8("Tobias Koenig <tokoe@kde.org>")
<< QStringLiteral("IMPORTANT: Akonadi Test")
<< QStringLiteral("Tobias Koenig <tokoe@kde.org>")
<< QStringLiteral("Tobias Koenig <tokoe@kde.org>")
<< QString()
<< QString::fromUtf8("Ingo Kloecker <kloecker@kde.org>")
<< QStringLiteral("Ingo Kloecker <kloecker@kde.org>")
<< QString()
<< QString()
<< QString()
<< QString::fromUtf8("<{7b55527e-77f4-489d-bf18-e805be96718c}@server.kde.org>")
<< QString::fromUtf8("<{8888827e-77f4-489d-bf18-e805be96718c}@server.kde.org> <{9999927e-77f4-489d-bf18-e805be96718c}@server.kde.org>");
<< QStringLiteral("<{7b55527e-77f4-489d-bf18-e805be96718c}@server.kde.org>")
<< QStringLiteral("<{8888827e-77f4-489d-bf18-e805be96718c}@server.kde.org> <{9999927e-77f4-489d-bf18-e805be96718c}@server.kde.org>");
QBuffer buffer;
buffer.open(QIODevice::WriteOnly);
QDataStream stream(&buffer);
stream << QDateTime(QDate(2015, 6, 29), QTime(23, 50, 10), Qt::UTC)
<< QString::fromUtf8("Důležité: Testování Akonadi")
<< QString::fromUtf8("<1234567.icameup@withthis>")
<< QString::fromUtf8("<2849719.IhmDc3qecs@thor>")
<< QString::fromUtf8("<1234567.icameup@withthis> <7654321.icameupwith@thistoo>")
<< 1 << QString::fromUtf8("Daniel Vrátil") << QString::fromUtf8("dvratil") << QString::fromUtf8("kde.org")
<< 1 << QString::fromUtf8("Daniel Vrátil") << QString::fromUtf8("dvratil") << QString::fromUtf8("kde.org")
<< QStringLiteral("Důležité: Testování Akonadi")
<< QStringLiteral("<1234567.icameup@withthis>")
<< QStringLiteral("<2849719.IhmDc3qecs@thor>")
<< QStringLiteral("<1234567.icameup@withthis> <7654321.icameupwith@thistoo>")
<< 1 << QStringLiteral("Daniel Vrátil") << QStringLiteral("dvratil") << QStringLiteral("kde.org")
<< 1 << QStringLiteral("Daniel Vrátil") << QStringLiteral("dvratil") << QStringLiteral("kde.org")
<< 0
<< 1 << QString::fromUtf8("Volker Krause") << QString::fromUtf8("vkrause") << QString::fromUtf8("kde.org")
<< 1 << QStringLiteral("Volker Krause") << QStringLiteral("vkrause") << QStringLiteral("kde.org")
<< 0
<< 0;
......@@ -91,16 +91,16 @@ void MailSerializerTest::testEnvelopeDeserialize_data()
<< 2
<< buffer.data()
<< QDateTime(QDate(2015, 6, 29), QTime(23, 50, 10), Qt::UTC)
<< QString::fromUtf8("Důležité: Testování Akonadi")
<< QString::fromUtf8("Daniel Vrátil <dvratil@kde.org>")
<< QString::fromUtf8("Daniel Vrátil <dvratil@kde.org>")
<< QStringLiteral("Důležité: Testování Akonadi")
<< QStringLiteral("Daniel Vrátil <dvratil@kde.org>")
<< QStringLiteral("Daniel Vrátil <dvratil@kde.org>")
<< QString() // reply to
<< QString::fromUtf8("Volker Krause <vkrause@kde.org>")
<< QStringLiteral("Volker Krause <vkrause@kde.org>")
<< QString() // cc
<< QString() // bcc
<< QString::fromUtf8("<1234567.icameup@withthis>")
<< QString::fromUtf8("<2849719.IhmDc3qecs@thor>")
<< QString::fromUtf8("<1234567.icameup@withthis> <7654321.icameupwith@thistoo>");
<< QStringLiteral("<1234567.icameup@withthis>")
<< QStringLiteral("<2849719.IhmDc3qecs@thor>")
<< QStringLiteral("<1234567.icameup@withthis> <7654321.icameupwith@thistoo>");
}
void MailSerializerTest::testEnvelopeDeserialize()
......@@ -169,27 +169,27 @@ void MailSerializerTest::testEnvelopeSerialize_data()
buffer.open(QIODevice::WriteOnly);
QDataStream stream(&buffer);
stream << QDateTime(QDate(2006, 2, 1), QTime(13, 37, 19), Qt::UTC)
<< QString::fromUtf8("IMPORTANT: Akonadi Test")
<< QStringLiteral("IMPORTANT: Akonadi Test")
<< QString()
<< QString::fromUtf8("<{7b55527e-77f4-489d-bf18-e805be96718c}@server.kde.org>")
<< QStringLiteral("<{7b55527e-77f4-489d-bf18-e805be96718c}@server.kde.org>")
<< QString()
<< 1 << QString::fromUtf8("Tobias Koenig") << QString::fromUtf8("tokoe") << QString::fromUtf8("kde.org")
<< 1 << QString::fromUtf8("Tobias Koenig") << QString::fromUtf8("tokoe") << QString::fromUtf8("kde.org")
<< 1 << QStringLiteral("Tobias Koenig") << QStringLiteral("tokoe") << QStringLiteral("kde.org")
<< 1 << QStringLiteral("Tobias Koenig") << QStringLiteral("tokoe") << QStringLiteral("kde.org")
<< 0
<< 1 << QString::fromUtf8("Ingo Kloecker") << QString::fromUtf8("kloecker") << QString::fromUtf8("kde.org")
<< 1 << QStringLiteral("Ingo Kloecker") << QStringLiteral("kloecker") << QStringLiteral("kde.org")
<< 0
<< 0;
QTest::newRow("")
<< QDateTime(QDate(2006, 2, 1), QTime(13, 37, 19), Qt::UTC)
<< QString::fromUtf8("IMPORTANT: Akonadi Test")
<< QString::fromUtf8("Tobias Koenig <tokoe@kde.org>")
<< QString::fromUtf8("Tobias Koenig <tokoe@kde.org>")
<< QStringLiteral("IMPORTANT: Akonadi Test")
<< QStringLiteral("Tobias Koenig <tokoe@kde.org>")
<< QStringLiteral("Tobias Koenig <tokoe@kde.org>")
<< QString()
<< QString::fromUtf8("Ingo Kloecker <kloecker@kde.org>")
<< QStringLiteral("Ingo Kloecker <kloecker@kde.org>")
<< QString()
<< QString()
<< QString()
<< QString::fromUtf8("<{7b55527e-77f4-489d-bf18-e805be96718c}@server.kde.org>")
<< QStringLiteral("<{7b55527e-77f4-489d-bf18-e805be96718c}@server.kde.org>")
<< QString()
<< buffer.data();
}
......@@ -283,9 +283,9 @@ void MailSerializerTest::testHeaderFetch()
"Message-Id: <1233469522.741324.18468.nullmailer@svn.kde.org>\n"
"Subject: [kde-doc-english] KDE/kdeutils/kcalc\n");
QString expectedSubject = QString::fromUtf8("[kde-doc-english] KDE/kdeutils/kcalc");
QString expectedFrom = QString::fromUtf8("David Johnson <david@usermode.org>");
QString expectedTo = QString::fromUtf8("kde-commits@kde.org");
QString expectedSubject = QStringLiteral("[kde-doc-english] KDE/kdeutils/kcalc");
QString expectedFrom = QStringLiteral("David Johnson <david@usermode.org>");
QString expectedTo = QStringLiteral("kde-commits@kde.org");
// envelope
QBuffer buffer;
......@@ -324,9 +324,9 @@ void MailSerializerTest::testMultiDeserialize()
"\n"
"This is content");
QString expectedSubject = QString::fromUtf8("[kde-doc-english] KDE/kdeutils/kcalc");
QString expectedFrom = QString::fromUtf8("David Johnson <david@usermode.org>");
QString expectedTo = QString::fromUtf8("kde-commits@kde.org");
QString expectedSubject = QStringLiteral("[kde-doc-english] KDE/kdeutils/kcalc");
QString expectedFrom = QStringLiteral("David Johnson <david@usermode.org>");
QString expectedTo = QStringLiteral("kde-commits@kde.org");
QByteArray expectedBody("This is content");
// envelope
......
......@@ -101,7 +101,7 @@ EwsDeleteItemRequest::Response::Response(QXmlStreamReader &reader)
while (reader.readNextStartElement()) {
if (reader.namespaceUri() != ewsMsgNsUri && reader.namespaceUri() != ewsTypeNsUri) {
setErrorMsg(QStringLiteral("Unexpected namespace in %1 element: %2")
.arg(QStringLiteral("ResponseMessage")).arg(reader.namespaceUri().toString()));
.arg(QStringLiteral("ResponseMessage"), reader.namespaceUri().toString()));
return;
}
......
......@@ -389,7 +389,7 @@ bool EwsPropertyField::read(QXmlStreamReader &reader)
.arg(QStringLiteral("FieldIndex"));
return false;
}
unsigned index = indexStr.mid(tokens[1].size()).toUInt(&ok, 0);
unsigned index = indexStr.midRef(tokens[1].size()).toUInt(&ok, 0);
if (!ok) {
qCWarningNC(EWSCLI_LOG) << QStringLiteral("Error reading property field - error reading %1 attribute.")
.arg(QStringLiteral("FieldIndex"));
......
......@@ -48,7 +48,7 @@ public:
Unknown
};
Update(EwsPropertyField field, const QVariant &val, Type type)
Update(const EwsPropertyField &field, const QVariant &val, Type type)
: mField(field), mValue(val), mType(type) {}
EwsPropertyField mField;
......@@ -59,19 +59,19 @@ public:
class AppendUpdate : public Update
{
public:
AppendUpdate(EwsPropertyField field, const QVariant &val) : Update(field, val, Append) {}
AppendUpdate(const EwsPropertyField &field, const QVariant &val) : Update(field, val, Append) {}
};
class SetUpdate : public Update
{
public:
SetUpdate(EwsPropertyField field, const QVariant &val) : Update(field, val, Set) {}
SetUpdate(const EwsPropertyField &field, const QVariant &val) : Update(field, val, Set) {}
};
class DeleteUpdate : public Update
{
public:
DeleteUpdate(EwsPropertyField field) : Update(field, QVariant(), Delete) {}
DeleteUpdate(const EwsPropertyField &field) : Update(field, QVariant(), Delete) {}
};
class FolderChange
......
......@@ -59,25 +59,25 @@ public:
class AppendUpdate : public Update
{
public:
AppendUpdate(EwsPropertyField field, const QVariant &val) : Update(field, val, Append) {}
AppendUpdate(const EwsPropertyField &field, const QVariant &val) : Update(field, val, Append) {}
};
class SetUpdate : public Update
{
public:
SetUpdate(EwsPropertyField field, const QVariant &val) : Update(field, val, Set) {}
SetUpdate(const EwsPropertyField &field, const QVariant &val) : Update(field, val, Set) {}
};
class DeleteUpdate : public Update
{
public:
DeleteUpdate(EwsPropertyField field) : Update(field, QVariant(), Delete) {}
DeleteUpdate(const EwsPropertyField &field) : Update(field, QVariant(), Delete) {}
};
class ItemChange
{
public:
ItemChange(EwsId itemId, EwsItemType type) : mId(itemId), mType(type) {}
ItemChange(const EwsId &itemId, EwsItemType type) : mId(itemId), mType(type) {}
void addUpdate(const Update *upd)
{
mUpdates.append(QSharedPointer<const Update>(upd));
......
......@@ -33,6 +33,7 @@ inline QDebug operator<<(QDebug debug, const Akonadi::Item::List &items)
{
QDebugStateSaver saver(debug);
QStringList itemStrs;
itemStrs.reserve(items.count());
Q_FOREACH (const Akonadi::Item &item, items) {
itemStrs.append(ewsHash(item.remoteId()));
}
......@@ -51,6 +52,7 @@ inline QDebug operator<<(QDebug debug, const Akonadi::Collection::List &cols)
{
QDebugStateSaver saver(debug);
QStringList itemStrs;
itemStrs.reserve(cols.count());
Q_FOREACH (const Akonadi::Collection &col, cols) {
itemStrs.append(EwsClient::folderHash.value(col.remoteId(), ewsHash(col.remoteId())));
}
......@@ -69,6 +71,7 @@ inline QDebug operator<<(QDebug debug, const QSet<QByteArray> &items)
{
QDebugStateSaver saver(debug);
QStringList itemStrs;
itemStrs.reserve(items.count());
Q_FOREACH (const QByteArray &item, items) {
itemStrs.append(QString::fromLatin1(item));
}
......
......@@ -47,7 +47,7 @@ public Q_SLOTS:
protected:
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
private:
bool hasCheckedChildren(QModelIndex index) const;
bool hasCheckedChildren(const QModelIndex &index) const;
bool mFilterSelected;
};
......@@ -120,7 +120,7 @@ bool EwsSubscriptionFilterModel::filterAcceptsRow(int sourceRow, const QModelInd
}
}
bool EwsSubscriptionFilterModel::hasCheckedChildren(QModelIndex index) const
bool EwsSubscriptionFilterModel::hasCheckedChildren(const QModelIndex &index) const
{
QModelIndex child;
int row = 0;
......
......@@ -72,15 +72,15 @@ void FakeEwsConnection::dataAvailable()
mKeepAlive = false;
if (tokens.size() < 3) {
sendError(QLatin1String("Invalid request header"));
sendError(QStringLiteral("Invalid request header"));
return;
}
if (tokens.at(0) != "POST") {
sendError(QLatin1String("Expected POST request"));
sendError(QStringLiteral("Expected POST request"));
return;
}
if (tokens.at(1) != "/EWS/Exchange.asmx") {
sendError(QLatin1String("Invalid EWS URL"));
sendError(QStringLiteral("Invalid EWS URL"));
return;
}
mState = RequestReceived;
......@@ -94,7 +94,7 @@ void FakeEwsConnection::dataAvailable()
bool ok;
mContentLength = line.trimmed().mid(16).toUInt(&ok);
if (!ok) {
sendError(QLatin1String("Failed to parse content length."));
sendError(QStringLiteral("Failed to parse content length."));
return;
}
} else if (line.toLower().startsWith(QByteArray("authorization: basic "))) {
......@@ -113,7 +113,7 @@ void FakeEwsConnection::dataAvailable()
if (mState == HeadersReceived) {
if (mContentLength == 0) {
sendError(QLatin1String("Expected content"));
sendError(QStringLiteral("Expected content"));
return;
}
......@@ -205,7 +205,7 @@ void FakeEwsConnection::sendError(const QString &msg, ushort code)
void FakeEwsConnection::dataTimeout()
{
qCWarning(EWSFAKE_LOG) << QLatin1String("Timeout waiting for content.");
sendError(QLatin1String("Timeout waiting for content."));
sendError(QStringLiteral("Timeout waiting for content."));
}
FakeEwsServer::DialogEntry::HttpResponse FakeEwsConnection::parseRequest(const QString &content)
......
......@@ -26,6 +26,8 @@
DummyPasswordRequester::DummyPasswordRequester(QObject *parent)
: PasswordRequesterInterface(parent)
{
m_expectedCalls.reserve(10);
m_results.reserve(10);
for (int i = 0; i < 10; ++i) {
m_expectedCalls << StandardRequest;
m_results << PasswordRetrieved;
......
......@@ -483,7 +483,7 @@ void SessionPool::onCapabilitiesTestDone(KJob *job)
QObject::connect(nsJob, &KIMAP::NamespaceJob::result, this, &SessionPool::onNamespacesTestDone);
nsJob->start();
return;
} else if (m_capabilities.contains(QLatin1String("ID"))) {
} else if (m_capabilities.contains(QStringLiteral("ID"))) {
KIMAP::IdJob *idJob = new KIMAP::IdJob(capJob->session());
idJob->setField("name", m_clientId);
QObject::connect(idJob, &KIMAP::IdJob::result, this, &SessionPool::onIdDone);
......
......@@ -55,14 +55,14 @@ void BenchmarkTests::parsingBenchmarkComparison_data()
void BenchmarkTests::parsingBenchmarkComparison()
{
const KMime::Message::Ptr kolabItem = readMimeFile(TESTFILEDIR+QString::fromLatin1("/v2/event/complex.ics.mime"));
const KMime::Message::Ptr kolabItem = readMimeFile(TESTFILEDIR+QLatin1String("/v2/event/complex.ics.mime"));
KMime::Content *xmlContent = findContentByType(kolabItem, "application/x-vnd.kolab.event");
QVERIFY(xmlContent);
const QByteArray xmlData = xmlContent->decodedContent();
// qDebug() << xmlData;
const QDomDocument xmlDoc = KolabV2::Event::loadDocument(QString::fromUtf8(xmlData));
QVERIFY(!xmlDoc.isNull());
const KCalCore::Event::Ptr i = KolabV2::Event::fromXml(xmlDoc, QString::fromLatin1("Europe/Berlin"));
const KCalCore::Event::Ptr i = KolabV2::Event::fromXml(xmlDoc, QStringLiteral("Europe/Berlin"));
QVERIFY(i);
const Kolab::Event &event = Kolab::Conversion::fromKCalCore(*i);
const std::string &v3String = Kolab::writeEvent(event);
......@@ -75,7 +75,7 @@ void BenchmarkTests::parsingBenchmarkComparison()
// qDebug() << QString::fromStdString(v3String);
if (v2Parser) {
QBENCHMARK {
KolabV2::Event::fromXml(KolabV2::Event::loadDocument(QString::fromUtf8(xmlData)), QString::fromLatin1("Europe/Berlin"));
KolabV2::Event::fromXml(KolabV2::Event::loadDocument(QString::fromUtf8(xmlData)), QStringLiteral("Europe/Berlin"));
}
} else {
QBENCHMARK {
......
......@@ -250,7 +250,7 @@ void FormatTest::testContact()
convertedAddressee.setName(realAddressee.name()); // name() apparently is something strange
if (version == Kolab::KolabV2) { //No creation date in xcal
QVERIFY(!convertedAddressee.custom("KOLAB", "CreationDate").isEmpty());
convertedAddressee.removeCustom("KOLAB", "CreationDate"); // that's conversion time !?
convertedAddressee.removeCustom(QStringLiteral("KOLAB"), QStringLiteral("CreationDate")); // that's conversion time !?
} else {
normalizeContact(convertedAddressee);
normalizeContact(realAddressee);
......
......@@ -146,7 +146,7 @@ void KCalConversionTest::testConversion_data()
{
KCalCore::Event kcal;
kcal.setUid("uid");
kcal.setUid(QStringLiteral("uid"));
kcal.setCreated(toDate(date));
kcal.setLastModified(toDate(date));
kcal.setRevision(3);
......@@ -176,29 +176,29 @@ void KCalConversionTest::testConversion_data()
rr->setByMonths(intList);
rr->setByWeekNumbers(intList);
kcal.setSummary("summary");
kcal.setDescription("description");
kcal.setSummary(QStringLiteral("summary"));
kcal.setDescription(QStringLiteral("description"));
kcal.setPriority(3);
kcal.setStatus(KCalCore::Incidence::StatusConfirmed);
kcal.setLocation("location");
kcal.setOrganizer(KCalCore::Person::Ptr(new KCalCore::Person("organizer", "organizer@email")));
kcal.setLocation(QStringLiteral("location"));
kcal.setOrganizer(KCalCore::Person::Ptr(new KCalCore::Person(QStringLiteral("organizer"), QStringLiteral("organizer@email"))));
//Url
kcal.setNonKDECustomProperty("X-KOLAB-URL", "http://test.org");
KCalCore::Attendee::Ptr att(new KCalCore::Attendee("attendee", "attendee@email", false, KCalCore::Attendee::NeedsAction, KCalCore::Attendee::ReqParticipant));
att->setDelegate("mailto:delegatee<delegatee@email>");
att->setDelegator("mailto:delegator<delegator@email>");
kcal.setNonKDECustomProperty("X-KOLAB-URL", QStringLiteral("http://test.org"));
KCalCore::Attendee::Ptr att(new KCalCore::Attendee(QStringLiteral("attendee"), QStringLiteral("attendee@email"), false, KCalCore::Attendee::NeedsAction, KCalCore::Attendee::ReqParticipant));
att->setDelegate(QStringLiteral("mailto:delegatee<delegatee@email>"));
att->setDelegator(QStringLiteral("mailto:delegator<delegator@email>"));
kcal.addAttendee(att);
kcal.addAttachment(KCalCore::Attachment::Ptr(new KCalCore::Attachment(QString("uri"), "mimetype/mime")));
kcal.addAttachment(KCalCore::Attachment::Ptr(new KCalCore::Attachment(QStringLiteral("uri"), QStringLiteral("mimetype/mime"))));
KCalCore::Alarm::Ptr alarm = KCalCore::Alarm::Ptr(new KCalCore::Alarm(&kcal));
KCalCore::Person::List addressees;
addressees.append(KCalCore::Person::Ptr(new KCalCore::Person("name", "email@email")));
alarm->setEmailAlarm("subject", "text", addressees, QStringList()); //No support for attachments
addressees.append(KCalCore::Person::Ptr(new KCalCore::Person(QStringLiteral("name"), QStringLiteral("email@email"))));
alarm->setEmailAlarm(QStringLiteral("subject"), QStringLiteral("text"), addressees, QStringList()); //No support for attachments
kcal.addAlarm(alarm);
//TODO alarms
kcal.setNonKDECustomProperty("X-KOLAB-key1", "value1");
kcal.setNonKDECustomProperty("X-KOLAB-key2", "value2");
kcal.setCustomProperty("SOMEOTHERAPP", "key2", "value2");
kcal.setNonKDECustomProperty("X-KOLAB-key1", QStringLiteral("value1"));
kcal.setNonKDECustomProperty("X-KOLAB-key2", QStringLiteral("value2"));
kcal.setCustomProperty("SOMEOTHERAPP", "key2", QStringLiteral("value2"));
Q_ASSERT(kcal.nonKDECustomProperty("X-KOLAB-key1") == "value1");
Kolab::Event kolab;
......@@ -265,7 +265,7 @@ void KCalConversionTest::testConversion_data()
}
{
KCalCore::Event kcal;
kcal.setUid("uid");
kcal.setUid(QStringLiteral("uid"));
kcal.setCreated(toDate(date));
kcal.setLastModified(toDate(date));
kcal.setRevision(3);
......@@ -295,7 +295,7 @@ void KCalConversionTest::testConversion_data()
Kolab::cDateTime end(2011, 1, 3);
KCalCore::Event kcal;
kcal.setUid("uid");
kcal.setUid(QStringLiteral("uid"));
kcal.setCreated(toDate(date));
kcal.setLastModified(toDate(date));
kcal.setDtStart(toDate(start));
......@@ -320,19 +320,19 @@ void KCalConversionTest::testConversion_data()
}
{
KCalCore::Event kcal;
kcal.setUid("uid");
kcal.setUid(QStringLiteral("uid"));
kcal.setCreated(toDate(date));
kcal.setLastModified(toDate(date));
kcal.setDtStart(toDate(date));
kcal.setAllDay(date.isDateOnly());
kcal.setSummary("äöü%@$£é¤¼²°€Š�");
kcal.setSummary(QStringLiteral("äöü%@$£é¤¼²°€Š�"));
Kolab::Event kolab;
kolab.setUid("uid");
kolab.setCreated(date);
kolab.setLastModified(date);
kolab.setStart(date);
kolab.setSummary(std::string(QString("äöü%@$£é¤¼²°€Š�").toUtf8().constData()));
kolab.setSummary(std::string(QStringLiteral("äöü%@$£é¤¼²°€Š�").toUtf8().constData()));
QTest::newRow("latin1+Unicode") << kcal << kolab;
}
......@@ -417,11 +417,11 @@ void KCalConversionTest::testTodoConversion_data()
{
KCalCore::Todo kcal;
kcal.setUid("uid");
kcal.setUid(QStringLiteral("uid"));
kcal.setDtStart(toDate(date));
kcal.setDtDue(toDate(date2));
kcal.setAllDay(date.isDateOnly());
kcal.setRelatedTo("uid2", KCalCore::Incidence::RelTypeParent);
kcal.setRelatedTo(QStringLiteral("uid2"), KCalCore::Incidence::RelTypeParent);
Kolab::Todo kolab;
kolab.setUid("uid");
......@@ -464,9 +464,9 @@ void KCalConversionTest::testJournalConversion_data()
{
KCalCore::Journal kcal;
kcal.setUid("uid");
kcal.setUid(QStringLiteral("uid"));
kcal.setDtStart(toDate(date));
kcal.setSummary("summary");
kcal.setSummary(QStringLiteral("summary"));
Kolab::Journal kolab;
kolab.setUid("uid");
......@@ -501,8 +501,8 @@ void KCalConversionTest::testContactConversion_data()
{
KContacts::Addressee kcal;
kcal.setUid("uid");
kcal.setFormattedName("name");
kcal.setUid(QStringLiteral("uid"));
kcal.setFormattedName(QStringLiteral("name"));
Kolab::Contact kolab;
kolab.setUid("uid");
......@@ -512,8 +512,8 @@ void KCalConversionTest::testContactConversion_data()
}
{
KContacts::Addressee kcal;
kcal.setUid("uid");
kcal.setFormattedName("name");
kcal.setUid(QStringLiteral("uid"));
kcal.setFormattedName(QStringLiteral("name"));
kcal.setBirthday(QDateTime(QDate(2012, 2, 2)));
//Because QDateTime doesn't know date-only values we always end up with a date-time
......@@ -526,10 +526,10 @@ void KCalConversionTest::testContactConversion_data()
}
{
KContacts::Addressee kcal;
kcal.setUid("uid");
kcal.setUid(QStringLiteral("uid"));
//The first address is always the preferred
kcal.setEmails(QStringList() << "email1@example.org" << "email2@example.org");
kcal.insertCustom("KOLAB", "EmailTypesemail1@example.org", "home,work");
kcal.setEmails(QStringList() << QStringLiteral("email1@example.org") << QStringLiteral("email2@example.org"));
kcal.insertCustom(QStringLiteral("KOLAB"), QStringLiteral("EmailTypesemail1@example.org"), QStringLiteral("home,work"));
Kolab::Contact kolab;
kolab.setUid("uid");
......
......@@ -44,7 +44,7 @@ void KolabObjectTest::preserveUnicode()
KCalCore::Event::Ptr event(new KCalCore::Event());
event->setDtStart(QDateTime(QDate(2014, 1, 1), {}));
event->setAllDay(true);
QString summary(QString::fromUtf8("€Š�ـأبـ☺"));
QString summary(QStringLiteral("€Š�ـأبـ☺"));
event->setSummary(summary);
QCOMPARE(event->summary(), summary);
// std::cout << event->summary().toStdString() << std::endl;
......@@ -87,7 +87,7 @@ void KolabObjectTest::parseRelationMembers()
{
{
QString memberString(
"imap:/user/jan.aachen%40lhm.klab.cc/INBOX/20?message-id=%3Cf06aa3345a25005380b47547ad161d36%40lhm.klab.cc%3E&subject=Re%3A+test&date=Tue%2C+12+Aug+2014+20%3A42%3A59+%2B0200");
QStringLiteral("imap:/user/jan.aachen%40lhm.klab.cc/INBOX/20?message-id=%3Cf06aa3345a25005380b47547ad161d36%40lhm.klab.cc%3E&subject=Re%3A+test&date=Tue%2C+12+Aug+2014+20%3A42%3A59+%2B0200"));
Kolab::RelationMember member = Kolab::parseMemberUrl(memberString);
QString result = Kolab::generateMemberUrl(member);
......@@ -102,10 +102,10 @@ void KolabObjectTest::parseRelationMembers()
Kolab::RelationMember member;
member.uid = 20;
member.mailbox = QList<QByteArray>() << "INBOX";
member.user = "john.doe@example.org";
member.messageId = "messageid";
member.date = "date";
member.subject = "subject";
member.user = QStringLiteral("john.doe@example.org");
member.messageId = QStringLiteral("messageid");
member.date = QStringLiteral("date");
member.subject = QStringLiteral("subject");
QString url = Kolab::generateMemberUrl(member);
qDebug() << url;
Kolab::RelationMember result = Kolab::parseMemberUrl(url);
......@@ -123,9 +123,9 @@ void KolabObjectTest::parseRelationMembers()
Kolab::RelationMember member;
member.uid = 20;
member.mailbox = QList<QByteArray>() << "foo" << "bar";
member.messageId = "messageid"; </