summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2017-09-29 08:03:23 +0200
committerMontel Laurent <[email protected]>2017-09-29 08:03:23 +0200
commitdb8e6702e1fd0625f540560a3507d450e221d0a8 (patch)
tree950f9458cdc771492bbe5ebafc367b8d86280611
parent070497c5c6750d135e1251afc91f85e099dd0a3e (diff)
Minor optimization
-rw-r--r--resources/kolab/libkolab/calendaring/event.cpp2
-rw-r--r--resources/kolab/libkolab/kolabformatV2/contact.cpp2
-rw-r--r--resources/kolab/libkolab/kolabformatV2/incidence.cpp10
-rw-r--r--resources/kolab/libkolab/kolabformatV2/journal.cpp14
-rw-r--r--resources/kolab/libkolab/kolabformatV2/kolabbase.cpp20
-rw-r--r--resources/kolab/libkolab/kolabformatV2/note.cpp12
-rw-r--r--resources/kolab/libkolab/mime/mimeutils.cpp2
7 files changed, 31 insertions, 31 deletions
diff --git a/resources/kolab/libkolab/calendaring/event.cpp b/resources/kolab/libkolab/calendaring/event.cpp
index f56ac01..60420f8 100644
--- a/resources/kolab/libkolab/calendaring/event.cpp
+++ b/resources/kolab/libkolab/calendaring/event.cpp
@@ -187,7 +187,7 @@ void Event::delegate(const std::vector< Attendee >& delegators, const std::vecto
Attendee *Event::getAttendee(const ContactReference &ref)
{
for(std::vector <Kolab::Attendee >::iterator it = d->attendees.begin();
- it != d->attendees.end(); it++) {
+ it != d->attendees.end(); ++it) {
if (it->contact().uid() == ref.uid() || it->contact().email() == ref.email() || it->contact().name() == ref.name()) {
return &*it;
}
diff --git a/resources/kolab/libkolab/kolabformatV2/contact.cpp b/resources/kolab/libkolab/kolabformatV2/contact.cpp
index ff3214a..d64cfc1 100644
--- a/resources/kolab/libkolab/kolabformatV2/contact.cpp
+++ b/resources/kolab/libkolab/kolabformatV2/contact.cpp
@@ -1049,7 +1049,7 @@ void Contact::setFields( const KContacts::Addressee* addressee )
int pos = (*it).indexOf( '-' );
if ( pos == -1 ) continue;
QString app = (*it).left( pos );
- if ( app == "KOLAB" ) continue;
+ if ( app == QLatin1String("KOLAB") ) continue;
QString name = (*it).mid( pos + 1 );
pos = name.indexOf( ':' );
if ( pos == -1 ) continue;
diff --git a/resources/kolab/libkolab/kolabformatV2/incidence.cpp b/resources/kolab/libkolab/kolabformatV2/incidence.cpp
index 24c36ff..e3e275e 100644
--- a/resources/kolab/libkolab/kolabformatV2/incidence.cpp
+++ b/resources/kolab/libkolab/kolabformatV2/incidence.cpp
@@ -765,13 +765,13 @@ void Incidence::setRecurrence( KCalCore::Recurrence* recur )
}
int howMany = recur->duration();
if ( howMany > 0 ) {
- mRecurrence.rangeType = "number";
+ mRecurrence.rangeType = QStringLiteral("number");
mRecurrence.range = QString::number( howMany );
} else if ( howMany == 0 ) {
- mRecurrence.rangeType = "date";
+ mRecurrence.rangeType = QStringLiteral("date");
mRecurrence.range = dateToString( recur->endDate() );
} else {
- mRecurrence.rangeType = "none";
+ mRecurrence.rangeType = QStringLiteral("none");
}
}
@@ -833,7 +833,7 @@ void Incidence::setFields( const KCalCore::Incidence::Ptr &incidence )
// Attachments
KCalCore::Attachment::List attachments = incidence->attachments();
- foreach ( KCalCore::Attachment::Ptr a, attachments ) {
+ foreach ( const KCalCore::Attachment::Ptr &a, attachments ) {
mAttachments.push_back( a );
}
@@ -841,7 +841,7 @@ void Incidence::setFields( const KCalCore::Incidence::Ptr &incidence )
// Alarms
KCalCore::Alarm::List alarms = incidence->alarms();
- foreach ( KCalCore::Alarm::Ptr a, alarms ) {
+ foreach ( const KCalCore::Alarm::Ptr &a, alarms ) {
mAlarms.push_back( a );
}
diff --git a/resources/kolab/libkolab/kolabformatV2/journal.cpp b/resources/kolab/libkolab/kolabformatV2/journal.cpp
index 48020e4..c00b50e 100644
--- a/resources/kolab/libkolab/kolabformatV2/journal.cpp
+++ b/resources/kolab/libkolab/kolabformatV2/journal.cpp
@@ -101,9 +101,9 @@ bool Journal::loadAttribute( QDomElement& element )
{
QString tagName = element.tagName();
- if ( tagName == "summary" )
+ if ( tagName == QLatin1String("summary") )
setSummary( element.text() );
- else if ( tagName == "start-date" )
+ else if ( tagName == QLatin1String("start-date") )
setStartDate( stringToDateTime( element.text() ) );
else
// Not handled here
@@ -118,8 +118,8 @@ bool Journal::saveAttributes( QDomElement& element ) const
// Save the base class elements
KolabBase::saveAttributes( element );
- writeString( element, "summary", summary() );
- writeString( element, "start-date", dateTimeToString( startDate() ) );
+ writeString( element, QStringLiteral("summary"), summary() );
+ writeString( element, QStringLiteral("start-date"), dateTimeToString( startDate() ) );
return true;
}
@@ -129,7 +129,7 @@ bool Journal::loadXML( const QDomDocument& document )
{
QDomElement top = document.documentElement();
- if ( top.tagName() != "journal" ) {
+ if ( top.tagName() != QLatin1String("journal") ) {
qWarning( "XML error: Top tag was %s instead of the expected Journal",
top.tagName().toAscii().data() );
return false;
@@ -154,8 +154,8 @@ bool Journal::loadXML( const QDomDocument& document )
QString Journal::saveXML() const
{
QDomDocument document = domTree();
- QDomElement element = document.createElement( "journal" );
- element.setAttribute( "version", "1.0" );
+ QDomElement element = document.createElement( QStringLiteral("journal") );
+ element.setAttribute( QStringLiteral("version"), QStringLiteral("1.0") );
saveAttributes( element );
document.appendChild( element );
return document.toString();
diff --git a/resources/kolab/libkolab/kolabformatV2/kolabbase.cpp b/resources/kolab/libkolab/kolabformatV2/kolabbase.cpp
index c5a1b23..5bad620 100644
--- a/resources/kolab/libkolab/kolabformatV2/kolabbase.cpp
+++ b/resources/kolab/libkolab/kolabformatV2/kolabbase.cpp
@@ -151,7 +151,7 @@ void KolabBase::saveTo( KContacts::Addressee* addressee ) const
addressee->setNote( body() );
addressee->setCategories( categories().split( ',', QString::SkipEmptyParts ) );
addressee->setRevision( lastModified().toZone( mTimeZone ).dateTime() );
- addressee->insertCustom( "KOLAB", "CreationDate",
+ addressee->insertCustom( QStringLiteral("KOLAB"), QStringLiteral("CreationDate"),
dateTimeToString( creationDate() ) );
switch( sensitivity() ) {
@@ -323,47 +323,47 @@ bool KolabBase::loadAttribute( QDomElement& element )
const QString tagName = element.tagName();
switch ( tagName[0].toLatin1() ) {
case 'u':
- if ( tagName == "uid" ) {
+ if ( tagName == QLatin1String("uid") ) {
setUid( element.text() );
return true;
}
break;
case 'b':
- if ( tagName == "body" ) {
+ if ( tagName == QLatin1String("body") ) {
setBody( element.text() );
return true;
}
break;
case 'c':
- if ( tagName == "categories" ) {
+ if ( tagName == QLatin1String("categories") ) {
setCategories( element.text() );
return true;
}
- if ( tagName == "creation-date" ) {
+ if ( tagName == QLatin1String("creation-date") ) {
setCreationDate( stringToDateTime( element.text() ) );
return true;
}
break;
case 'l':
- if ( tagName == "last-modification-date" ) {
+ if ( tagName == QLatin1String("last-modification-date") ) {
setLastModified( stringToDateTime( element.text() ) );
return true;
}
break;
case 's':
- if ( tagName == "sensitivity" ) {
+ if ( tagName == QLatin1String("sensitivity") ) {
setSensitivity( stringToSensitivity( element.text() ) );
return true;
}
break;
case 'p':
- if ( tagName == "product-id" )
+ if ( tagName == QLatin1String("product-id") )
return true; // ignore this field
- if ( tagName == "pilot-sync-id" ) {
+ if ( tagName == QLatin1String("pilot-sync-id") ) {
setPilotSyncId( element.text().toULong() );
return true;
}
- if ( tagName == "pilot-sync-status" ) {
+ if ( tagName == QLatin1String("pilot-sync-status") ) {
setPilotSyncStatus( element.text().toInt() );
return true;
}
diff --git a/resources/kolab/libkolab/kolabformatV2/note.cpp b/resources/kolab/libkolab/kolabformatV2/note.cpp
index a175246..664f0de 100644
--- a/resources/kolab/libkolab/kolabformatV2/note.cpp
+++ b/resources/kolab/libkolab/kolabformatV2/note.cpp
@@ -108,14 +108,14 @@ bool Note::richText() const
bool Note::loadAttribute( QDomElement& element )
{
QString tagName = element.tagName();
- if ( tagName == "summary" )
+ if ( tagName == QLatin1String("summary") )
setSummary( element.text() );
- else if ( tagName == "foreground-color" )
+ else if ( tagName == QLatin1String("foreground-color") )
setForegroundColor( stringToColor( element.text() ) );
- else if ( tagName == "background-color" )
+ else if ( tagName == QLatin1String("background-color") )
setBackgroundColor( stringToColor( element.text() ) );
- else if ( tagName == "knotes-richtext" )
- mRichText = ( element.text() == "true" );
+ else if ( tagName == QLatin1String("knotes-richtext") )
+ mRichText = ( element.text() == QLatin1String("true") );
else
return KolabBase::loadAttribute( element );
@@ -149,7 +149,7 @@ bool Note::loadXML( const QDomDocument& document )
{
QDomElement top = document.documentElement();
- if ( top.tagName() != "note" ) {
+ if ( top.tagName() != QLatin1String("note") ) {
qWarning( "XML error: Top tag was %s instead of the expected note",
top.tagName().toAscii().data() );
return false;
diff --git a/resources/kolab/libkolab/mime/mimeutils.cpp b/resources/kolab/libkolab/mime/mimeutils.cpp
index 932b985..6710d84 100644
--- a/resources/kolab/libkolab/mime/mimeutils.cpp
+++ b/resources/kolab/libkolab/mime/mimeutils.cpp
@@ -199,7 +199,7 @@ KMime::Content* createAttachmentPart(const QByteArray& cid, const QByteArray& mi
Kolab::Attachment getAttachment(const std::string &id, const KMime::Message::Ptr &mimeData)
{
- if (!QString::fromStdString(id).contains("cid:")) {
+ if (!QString::fromStdString(id).contains(QLatin1String("cid:"))) {
Error() << "not a cid reference";
return Kolab::Attachment();
}