Commit 6ca4c2c0 authored by Laurent Montel's avatar Laurent Montel 😁

Minor optimization

parent de44002c
......@@ -74,11 +74,11 @@ void KolabV2::DistributionList::loadDistrListMember( const QDomElement& element
if ( n.isElement() ) {
QDomElement e = n.toElement();
QString tagName = e.tagName();
if ( tagName == "display-name" )
if ( tagName == QLatin1String("display-name") )
member.displayName = e.text();
else if ( tagName == "smtp-address" )
else if ( tagName == QLatin1String("smtp-address" ))
member.email = e.text();
else if ( tagName == "uid" )
else if ( tagName == QLatin1String("uid") )
member.uid = e.text();
}
}
......@@ -90,14 +90,14 @@ void DistributionList::saveDistrListMembers( QDomElement& element ) const
QList<Member>::ConstIterator it = mDistrListMembers.constBegin();
const QList<Member>::ConstIterator end = mDistrListMembers.constEnd();
for( ; it != end; ++it ) {
QDomElement e = element.ownerDocument().createElement( "member" );
QDomElement e = element.ownerDocument().createElement( QStringLiteral("member") );
element.appendChild( e );
const Member& m = *it;
if (!m.uid.isEmpty()) {
writeString( e, "uid", m.uid );
writeString( e, QStringLiteral("uid"), m.uid );
} else {
writeString( e, "display-name", m.displayName );
writeString( e, "smtp-address", m.email );
writeString( e, QStringLiteral("display-name"), m.displayName );
writeString( e, QStringLiteral("smtp-address"), m.email );
}
}
}
......
......@@ -138,14 +138,14 @@ bool Event::saveAttributes( QDomElement& element ) const
// TODO: Support tentative and outofoffice
if ( transparency() == KCalCore::Event::Transparent )
writeString( element, "show-time-as", "free" );
writeString( element, QStringLiteral("show-time-as"), QStringLiteral("free") );
else
writeString( element, "show-time-as", "busy" );
writeString( element, QStringLiteral("show-time-as"), QStringLiteral("busy") );
if ( mHasEndDate ) {
if ( mFloatingStatus == HasTime )
writeString( element, "end-date", dateTimeToString( endDate() ) );
writeString( element, QStringLiteral("end-date"), dateTimeToString( endDate() ) );
else
writeString( element, "end-date", dateToString( endDate().date() ) );
writeString( element, QStringLiteral("end-date"), dateToString( endDate().date() ) );
}
return true;
......
......@@ -281,14 +281,14 @@ bool Task::loadXML( const QDomDocument& document )
QString Task::saveXML() const
{
QDomDocument document = domTree();
QDomElement element = document.createElement( "task" );
element.setAttribute( "version", "1.0" );
QDomElement element = document.createElement( QStringLiteral("task") );
element.setAttribute( QStringLiteral("version"), QStringLiteral("1.0") );
saveAttributes( element );
if ( !hasStartDate() && startDate().isValid() ) {
// events and journals always have a start date, but tasks don't.
// Remove the entry done by the inherited save above, because we
// don't have one.
QDomNodeList l = element.elementsByTagName( "start-date" );
QDomNodeList l = element.elementsByTagName( QStringLiteral("start-date") );
Q_ASSERT( l.count() == 1 );
element.removeChild( l.item( 0 ) );
}
......
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