[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdepimlibs/akregator_port] krss: disable implicit ascii/qstring conversions and compile without the
From:       Frank Osterfeld <frank.osterfeld () kdemail ! net>
Date:       2012-03-31 15:16:22
Message-ID: 20120331151622.238D5A60EE () git ! kde ! org
[Download RAW message or body]

Git commit cc4fc8005ff23025393b181162a0b6ff8aebd4ad by Frank Osterfeld.
Committed on 11/10/2009 at 11:39.
Pushed by osterfeld into branch 'akregator_port'.

disable implicit ascii/qstring conversions and compile without them

svn path=/branches/work/akonadi-ports/kdepim/; revision=1033820

M  +2    -2    krss/defaulttagprovider/defaulttagjobimpls.cpp
M  +8    -8    krss/defaulttagprovider/tagpropertiesattribute.cpp
M  +6    -6    krss/exportopmljob.cpp
M  +7    -7    krss/feedlistmodel.cpp
M  +6    -6    krss/importitemsjob.cpp
M  +8    -8    krss/importopmljob.cpp
M  +1    -1    krss/item.cpp
M  +2    -2    krss/itemmodel.cpp
M  +1    -1    krss/netfeed.cpp
M  +7    -7    krss/netfeedcreatejob.cpp
M  +4    -4    krss/netresource.cpp
M  +1    -1    krss/resourcemanager.cpp
M  +53   -53   krss/rssitemserializer_xml.cpp
M  +2    -2    krss/subscriptionlabelscollectionattribute.cpp
M  +1    -1    krss/tag_p.h
M  +2    -2    krss/tagidsattribute.cpp
M  +20   -20   krss/tests/feedcollectiontest.cpp
M  +6    -6    krss/tests/tagprovidertest.cpp
M  +3    -3    krss/tests/testitem.cpp
M  +29   -29   krss/tests/testxmlitemserializer.cpp

http://commits.kde.org/kdepimlibs/cc4fc8005ff23025393b181162a0b6ff8aebd4ad

diff --git a/krss/defaulttagprovider/defaulttagjobimpls.cpp \
b/krss/defaulttagprovider/defaulttagjobimpls.cpp index 9b43e1f..2f590ea 100644
--- a/krss/defaulttagprovider/defaulttagjobimpls.cpp
+++ b/krss/defaulttagprovider/defaulttagjobimpls.cpp
@@ -1,4 +1,4 @@
-/*
+    /*
     Copyright (C) 2008    Frank Osterfeld <osterfeld@kde.org>
     Copyright (C) 2009    Dmitry Ivanov <vonami@gmail.com>
 
@@ -108,7 +108,7 @@ void DefaultTagCreateJob::doStart()
     }
 
     // generate a pseudo unique URI
-    const QString remoteId = "rss-tag-" + KRandom::randomString( 10 );
+    const QString remoteId = QLatin1String("rss-tag-") + KRandom::randomString( 10 \
);  TagPrivate::tag_d( m_tag )->m_collection.setRemoteId( remoteId );
     const Collection col = TagPrivate::tag_d( m_tag )->m_collection;
     SearchCreateJob *sjob = new SearchCreateJob( col.name(), col.remoteId() );
diff --git a/krss/defaulttagprovider/tagpropertiesattribute.cpp \
b/krss/defaulttagprovider/tagpropertiesattribute.cpp index 0e074b4..103c64c 100644
--- a/krss/defaulttagprovider/tagpropertiesattribute.cpp
+++ b/krss/defaulttagprovider/tagpropertiesattribute.cpp
@@ -43,10 +43,10 @@ TagPropertiesAttribute* TagPropertiesAttribute::clone() const
 QByteArray TagPropertiesAttribute::serialized() const
 {
     QStringList props;
-    props << "Label=" + m_label;
-    props << "Description=" + m_description;
-    props << "Icon=" + m_icon;
-    return props.join( ";" ).toUtf8();
+    props << QLatin1String("Label=") + m_label;
+    props << QLatin1String("Description=") + m_description;
+    props << QLatin1String("Icon=") + m_icon;
+    return props.join( QLatin1String(";") ).toUtf8();
 }
 
 void TagPropertiesAttribute::deserialize( const QByteArray& data )
@@ -55,10 +55,10 @@ void TagPropertiesAttribute::deserialize( const QByteArray& data \
)  return;
 
     // so ugly, am i missing something?
-    QStringList props = QString::fromUtf8( data.constData(), data.size() ).split( \
                ';' );
-    m_label = props[0].split( '=' )[1];
-    m_description = props[1].split( '=' )[1];
-    m_icon = props[2].split( '=' )[1];
+    const QStringList props = QString::fromUtf8( data.constData(), data.size() \
).split( QLatin1Char(';') ); +    m_label = props[0].split( QLatin1Char('=') )[1];
+    m_description = props[1].split( QLatin1Char('=') )[1];
+    m_icon = props[2].split( QLatin1Char('=') )[1];
 }
 
 QString TagPropertiesAttribute::label() const
diff --git a/krss/exportopmljob.cpp b/krss/exportopmljob.cpp
index 9bebac8..6bdbeff 100644
--- a/krss/exportopmljob.cpp
+++ b/krss/exportopmljob.cpp
@@ -53,9 +53,9 @@ public:
 ExportOpmlJob::Private::Private( const QString& dbusService, ExportOpmlJob* qq )
   : q( qq )
   , interface( new org::kde::krss( dbusService,
-                                   "/KRss",
-                                    QDBusConnection::sessionBus(),
-                                    q ) )
+                                   QLatin1String("/KRss"),
+                                   QDBusConnection::sessionBus(),
+                                   q ) )
 {
 }
 
@@ -76,7 +76,7 @@ void ExportOpmlJob::start() {
 }
 
 void ExportOpmlJob::Private::doStart() {
-    if ( !interface->callWithCallback( "exportOpml", QList<QVariant>() << url.url(), \
q, SLOT(exportFinished(QVariantMap)) ) ) { +    if ( !interface->callWithCallback( \
QLatin1String("exportOpml"), QList<QVariant>() << url.url(), q, \
SLOT(exportFinished(QVariantMap)) ) ) {  q->setError( \
ExportOpmlJob::ExportFailedError );  q->setErrorText( i18n( "Could not start export." \
) );  q->emitResult();
@@ -84,10 +84,10 @@ void ExportOpmlJob::Private::doStart() {
 }
 
 void ExportOpmlJob::Private::exportFinished( const QVariantMap& map ) {
-    const int error = map.value( "error" ).toInt();
+    const int error = map.value( QLatin1String("error") ).toInt();
     if ( error != 0 ) {
         q->setError( ExportOpmlJob::ExportFailedError );
-        q->setErrorText( i18n( "Export from RSS resource failed: %1", map.value( \
"errorString" ).toString() ) ); +        q->setErrorText( i18n( "Export from RSS \
resource failed: %1", map.value( QLatin1String("errorString") ).toString() ) );  }
 
     q->emitResult();
diff --git a/krss/feedlistmodel.cpp b/krss/feedlistmodel.cpp
index ef9f180..9ffcc42 100644
--- a/krss/feedlistmodel.cpp
+++ b/krss/feedlistmodel.cpp
@@ -103,7 +103,7 @@ namespace {
         }
 
         void visit( const boost::shared_ptr<const TagNode>& tagNode ) {
-            m_icon = KIcon( "folder" ).pixmap( KIconLoader::SizeSmall );
+            m_icon = KIcon( QLatin1String("folder") ).pixmap( KIconLoader::SizeSmall \
);  }
 
         void visit( const boost::shared_ptr<const FeedNode>& feedNode ) {
@@ -114,7 +114,7 @@ namespace {
                 if ( !feed->hasError() )
                     m_icon = feed->icon().pixmap( KIconLoader::SizeSmall, \
QIcon::Normal );  else
-                    m_icon = KIcon( "dialog-warning" ).pixmap( \
KIconLoader::SizeSmall ); +                    m_icon = KIcon( \
QLatin1String("dialog-warning") ).pixmap( KIconLoader::SizeSmall );  }
         }
 
@@ -606,7 +606,7 @@ Qt::ItemFlags FeedListModel::flags( const QModelIndex& index ) \
const  QStringList FeedListModel::mimeTypes() const
 {
     QStringList types;
-    types << "text/uri-list" << KRSS_TREENODE_MIMETYPE;
+    types << QLatin1String("text/uri-list") << \
QLatin1String(KRSS_TREENODE_MIMETYPE);  return types;
 }
 
@@ -635,7 +635,7 @@ QMimeData* FeedListModel::mimeData( const QModelIndexList& \
indexes ) const  }
 
     mimeData->setUrls( urls );
-    mimeData->setData( KRSS_TREENODE_MIMETYPE, idList );
+    mimeData->setData( QLatin1String(KRSS_TREENODE_MIMETYPE), idList );
     return mimeData;
 }
 
@@ -649,7 +649,7 @@ bool FeedListModel::dropMimeData( const QMimeData* data, \
Qt::DropAction action,  if ( action == Qt::IgnoreAction )
         return true;
 
-    if ( !data->hasFormat( KRSS_TREENODE_MIMETYPE ) )
+    if ( !data->hasFormat( QLatin1String(KRSS_TREENODE_MIMETYPE) ) )
         return false;
 
     const shared_ptr<const TreeNode> droppedOnNode = FeedListModel::data( parent, \
FeedListModel::TreeNodeRole ) @@ -665,8 +665,8 @@ bool FeedListModel::dropMimeData( \
const QMimeData* data, Qt::DropAction action,  if ( droppedOnTag->tag() == \
d->m_allFeedsTag )  return false;
 
-    QByteArray idData = data->data( KRSS_TREENODE_MIMETYPE );
-    QDataStream stream( &idData, QIODevice::ReadOnly );
+    QByteArray idData = data->data( QLatin1String(KRSS_TREENODE_MIMETYPE) );
+    QDataStream stream( idData );
     while ( !stream.atEnd() ) {
         KRss::Feed::Id id;
         stream >> id;
diff --git a/krss/importitemsjob.cpp b/krss/importitemsjob.cpp
index 6208cfc..7b97249 100644
--- a/krss/importitemsjob.cpp
+++ b/krss/importitemsjob.cpp
@@ -48,9 +48,9 @@ public:
 ImportItemsJob::Private::Private( const QString& dbusService, ImportItemsJob* qq )
   : q( qq )
   , interface( new org::kde::krss( dbusService,
-                                   "/KRss",
-                                    QDBusConnection::sessionBus(),
-                                    q ) )
+                                   QLatin1String("/KRss"),
+                                   QDBusConnection::sessionBus(),
+                                   q ) )
 {
 }
 
@@ -76,7 +76,7 @@ void ImportItemsJob::start() {
 }
 
 void ImportItemsJob::Private::doStart() {
-    if ( !DBusHelper::callWithCallback( interface, "importItems", QList<QVariant>() \
<< url << sourceFile, q, SLOT(importFinished(QVariantMap)), \
SLOT(importError(QDBusError)), DBusHelper::NoTimeout ) ) { +    if ( \
!DBusHelper::callWithCallback( interface, QLatin1String("importItems"), \
QList<QVariant>() << url << sourceFile, q, SLOT(importFinished(QVariantMap)), \
SLOT(importError(QDBusError)), DBusHelper::NoTimeout ) ) {  q->setError( \
ImportItemsJob::ImportFailedError );  q->setErrorText( i18n( "Could not start \
import." ) );  q->emitResult();
@@ -84,9 +84,9 @@ void ImportItemsJob::Private::doStart() {
 }
 
 void ImportItemsJob::Private::importFinished( const QVariantMap& map ) {
-    if ( map.value( "error" ).toInt() != 0 ) {
+    if ( map.value( QLatin1String("error") ).toInt() != 0 ) {
         q->setError( ImportItemsJob::ImportFailedError );
-        q->setErrorText( map.value( "errorString" ).toString() );
+        q->setErrorText( map.value( QLatin1String("errorString") ).toString() );
     }
     q->emitResult();
 }
diff --git a/krss/importopmljob.cpp b/krss/importopmljob.cpp
index 1969334..dc9ed27 100644
--- a/krss/importopmljob.cpp
+++ b/krss/importopmljob.cpp
@@ -54,9 +54,9 @@ public:
 ImportOpmlJob::Private::Private( const QString& dbusService, ImportOpmlJob* qq )
   : q( qq )
   , interface( new org::kde::krss( dbusService,
-                                   "/KRss",
-                                    QDBusConnection::sessionBus(),
-                                    q ) )
+                                   QLatin1String("/KRss"),
+                                   QDBusConnection::sessionBus(),
+                                   q ) )
 {
 }
 
@@ -81,7 +81,7 @@ void ImportOpmlJob::start() {
 }
 
 void ImportOpmlJob::Private::doStart() {
-    if ( !interface->callWithCallback( "importOpml", QList<QVariant>() << url.url() \
<< QString(), q, SLOT(importFinished(QVariantMap)) ) ) { +    if ( \
!interface->callWithCallback( QLatin1String("importOpml"), QList<QVariant>() << \
url.url() << QString(), q, SLOT(importFinished(QVariantMap)) ) ) {  q->setError( \
ImportOpmlJob::ImportFailedError );  q->setErrorText( i18n( "Could not start import." \
) );  q->emitResult();
@@ -89,13 +89,13 @@ void ImportOpmlJob::Private::doStart() {
 }
 
 void ImportOpmlJob::Private::importFinished( const QVariantMap& map ) {
-    const int error = map.value( "error" ).toInt();
+    const int error = map.value( QLatin1String("error") ).toInt();
     if ( error != 0 ) {
         q->setError( ImportOpmlJob::ImportFailedError );
-        q->setErrorText( i18n( "Import into RSS resource failed: %1", map.value( \
"errorString" ).toString() ) ); +        q->setErrorText( i18n( "Import into RSS \
resource failed: %1", map.value( QLatin1String("errorString") ).toString() ) );  }
-    const QStringList feedUrls = map.value( "feedUrls" ).toStringList();
-    const QStringList feedTitles = map.value( "feedTitles" ).toStringList();
+    const QStringList feedUrls = map.value( QLatin1String("feedUrls") \
).toStringList(); +    const QStringList feedTitles = map.value( \
QLatin1String("feedTitles") ).toStringList();  
     assert( feedUrls.size() == feedTitles.size() );
     for ( int i = 0; i < feedUrls.size(); ++i ) {
diff --git a/krss/item.cpp b/krss/item.cpp
index 35e7b3b..1329768 100644
--- a/krss/item.cpp
+++ b/krss/item.cpp
@@ -42,7 +42,7 @@ const char* Item::ContentPart = "RssContent";
 // static
 QString Item::mimeType()
 {
-    return "application/rss+xml";
+    return QLatin1String("application/rss+xml");
 }
 
 Item::Item() : d( new Private )
diff --git a/krss/itemmodel.cpp b/krss/itemmodel.cpp
index ae1e373..a9695bc 100644
--- a/krss/itemmodel.cpp
+++ b/krss/itemmodel.cpp
@@ -68,7 +68,7 @@ public:
 };
 
 ItemModelPrivate::ItemModelPrivate( const shared_ptr<ItemListing>& items_, \
                ItemModel* qq )
-    : q( qq ), items( items_ ), m_importantIcon( KIcon( "mail-mark-important" ) )
+    : q( qq ), items( items_ ), m_importantIcon( KIcon( \
QLatin1String("mail-mark-important") ) )  {
     items->addListener( this );
 }
@@ -129,7 +129,7 @@ QVariant ItemModel::data( const QModelIndex &index, int role ) \
const  return item.titleAsPlainText();
             case AuthorsColumn:
                 Q_FOREACH( const KRss::Person &person, item.authors() ) {
-                    authors += person.name() + ';';
+                    authors += person.name() + QLatin1Char(';');
                 }
                 authors.remove( authors.length() - 1, 1 );
                 return authors;
diff --git a/krss/netfeed.cpp b/krss/netfeed.cpp
index 11d8c4c..efcbf9c 100644
--- a/krss/netfeed.cpp
+++ b/krss/netfeed.cpp
@@ -29,7 +29,7 @@ NetFeed::NetFeed( const FeedCollection& feedCollection, const \
shared_ptr<Resourc  QObject* parent )
     : Feed( feedCollection, resource, parent )
 {
-    setIcon( KIcon("application-rss+xml") );
+    setIcon( KIcon(QLatin1String("application-rss+xml")) );
 }
 
 void NetFeed::accept( FeedVisitor* v )
diff --git a/krss/netfeedcreatejob.cpp b/krss/netfeedcreatejob.cpp
index 64ef4a0..78dd075 100644
--- a/krss/netfeedcreatejob.cpp
+++ b/krss/netfeedcreatejob.cpp
@@ -124,31 +124,31 @@ void NetFeedCreateJobPrivate::doStart()
     }
 
     m_sharedResource = m_resource.lock();
-    org::kde::krss *interface = new org::kde::krss( "org.freedesktop.Akonadi.Agent." \
                + m_sharedResource->id(),
-                                                    "/KRss", \
QDBusConnection::sessionBus(), q ); +    org::kde::krss *interface = new \
org::kde::krss( QLatin1String("org.freedesktop.Akonadi.Agent.") + \
m_sharedResource->id(), +                                                    \
QLatin1String("/KRss"), QDBusConnection::sessionBus(), q );  
     // don't block, set callbacks instead
     QList<QVariant> argumentList;
     argumentList << qVariantFromValue( m_xmlUrl ) << qVariantFromValue( \
                m_subscriptionLabel );
-    if ( !interface->callWithCallback( QLatin1String( "addFeed" ), argumentList,
+    if ( !interface->callWithCallback( QLatin1String("addFeed"), argumentList,
                             q, SLOT( slotCallFinished(QVariantMap) ) ) ) {
         q->setError( NetFeedCreateJob::CouldNotCreateFeed );
-        q->setErrorText( "Failed to place a D-Bus call");
+        q->setErrorText( i18n( "Failed to place a D-Bus call" ) );
         q->emitResult();
     }
 }
 
 void NetFeedCreateJobPrivate::slotCallFinished( const QVariantMap& res )
 {
-    const int error = res.value( "error" ).toInt();
+    const int error = res.value( QLatin1String("error") ).toInt();
     if ( error ) {
-        const QString errorString = res.value( "errorString" ).toString();
+        const QString errorString = res.value( QLatin1String("errorString") \
).toString();  q->setError( NetFeedCreateJob::CouldNotCreateFeed );
         q->setErrorText( errorString );
         q->emitResult();
         return;
     }
-    m_id = res.value( "feedId" ).toLongLong();
+    m_id = res.value( QLatin1String("feedId") ).toLongLong();
 
     if ( m_feedList.expired() ) {
         q->emitResult();
diff --git a/krss/netresource.cpp b/krss/netresource.cpp
index fa57e96..4ad18b8 100644
--- a/krss/netresource.cpp
+++ b/krss/netresource.cpp
@@ -118,11 +118,11 @@ void NetResourcePrivate::slotFetchAborted( qlonglong id )
 }
 
 void NetResourcePrivate::slotFetchQueueStarted() {
-  emit q->fetchQueueStarted( q->id() );
+    emit q->fetchQueueStarted( q->id() );
 }
 
 void NetResourcePrivate::slotFetchQueueFinished() {
-  emit q->fetchQueueFinished( q->id() );
+    emit q->fetchQueueFinished( q->id() );
 }
 
 void NetResourcePrivate::slotRootCollectionRetrieved( KJob* j )
@@ -162,8 +162,8 @@ NetResource::NetResource( const QString& resourceId, const \
                QString& name, QObjec
     : Resource( *new NetResourcePrivate( resourceId, name, this ), parent )
 {
     Q_D( NetResource );
-    d->m_interface = new org::kde::krss( "org.freedesktop.Akonadi.Agent." + d->m_id,
-                                         "/KRss", QDBusConnection::sessionBus(), \
this ); +    d->m_interface = new org::kde::krss( \
QLatin1String("org.freedesktop.Akonadi.Agent.") + d->m_id, +                          \
QLatin1String("/KRss"), QDBusConnection::sessionBus(), this );  
     connect( d->m_interface, SIGNAL( fetchStarted( qlonglong ) ),
              this, SLOT( slotFetchStarted( qlonglong ) ) );
diff --git a/krss/resourcemanager.cpp b/krss/resourcemanager.cpp
index 04b1a6e..0b7dc68 100644
--- a/krss/resourcemanager.cpp
+++ b/krss/resourcemanager.cpp
@@ -68,7 +68,7 @@ void ResourceManager::forceUpdate()
 
     const QList<AgentInstance> instances = AgentManager::self()->instances();
     Q_FOREACH( const AgentInstance& instance, instances ) {
-        if ( !instance.type().capabilities().contains( "RssResource" ) )
+        if ( !instance.type().capabilities().contains( QLatin1String("RssResource") \
) )  continue;
         shared_ptr<NetResource> res = old.value( instance.identifier() );
         if ( !res )
diff --git a/krss/rssitemserializer_xml.cpp b/krss/rssitemserializer_xml.cpp
index 2204a24..f0201d6 100644
--- a/krss/rssitemserializer_xml.cpp
+++ b/krss/rssitemserializer_xml.cpp
@@ -48,13 +48,13 @@ enum TextMode {
 
 static QString krssNamespace()
 {
-    return "http://akregator.kde.org/krss#";
+    return QLatin1String("http://akregator.kde.org/krss#");
 }
 
 class Element
 {
 public:
-    Element( const QString& ns_, const QString& name_, const QVariant& defaultValue_ \
= QVariant() ) : ns( ns_ ), name( name_ ), qualifiedName( ns + ':' + name ), \
defaultValue( defaultValue_ ) +    Element( const QString& ns_, const QString& name_, \
const QVariant& defaultValue_ = QVariant() ) : ns( ns_ ), name( name_ ), \
qualifiedName( ns + QLatin1Char(':') + name ), defaultValue( defaultValue_ )  {
     }
 
@@ -87,7 +87,7 @@ public:
             writer.writeStartElement( ns, name );
         if ( mode == Html )
         {
-            writer.writeAttribute( "type", "html" );
+            writer.writeAttribute( QLatin1String("type"), QLatin1String("html") );
         }
         const QVariant qv( value );
         Q_ASSERT( qv.canConvert( QVariant::String ) );
@@ -101,30 +101,30 @@ struct Elements
     Elements() : atomNS( Syndication::Atom::atom1Namespace() ),
                  krssNS( krssNamespace() ),
                  commentNS( Syndication::commentApiNamespace() ),
-                 title( atomNS, "title", QString() ),
-                 summary( atomNS, "summary", QString() ),
-                 content( atomNS, "content", QString() ),
-                 link( atomNS, "link", QString() ),
-                 language( atomNS, "language", QString() ),
-                 guid( atomNS, "id", QString() ),
-                 published( atomNS, "published", KDateTime().toString( \
                KDateTime::ISODate ) ),
-                 updated( atomNS, "updated", KDateTime().toString( \
                KDateTime::ISODate ) ),
-                 commentsCount( Syndication::slashNamespace(), "comments", -1 ),
-                 commentsFeed( commentNS, "commentRss", QString() ),
-                 commentPostUri( commentNS, "comment", QString() ),
-                 commentsLink( krssNS, "commentsLink", QString() ),
-                 hash( krssNS, "hash", 0 ),
-                 guidIsHash( krssNS, "idIsHash", false ),
-                 sourceFeedId( krssNS, "sourceFeedId", -1 ),
-                 name( atomNS, "name", QString() ),
-                 uri( atomNS, "uri", QString() ),
-                 email( atomNS, "email", QString() ),
-                 author( atomNS, "author", QString() ),
-                 category( atomNS, "category", QString() ),
-                 customProperty( krssNS, "customProperty", QString() ),
-                 key( krssNS, "key", QString() ),
-                 value( krssNS, "value", QString() ),
-                 entry( atomNS, "entry", QString() )
+                 title( atomNS, QLatin1String("title"), QString() ),
+                 summary( atomNS, QLatin1String("summary"), QString() ),
+                 content( atomNS, QLatin1String("content"), QString() ),
+                 link( atomNS, QLatin1String("link"), QString() ),
+                 language( atomNS, QLatin1String("language"), QString() ),
+                 guid( atomNS, QLatin1String("id"), QString() ),
+                 published( atomNS, QLatin1String("published"), \
KDateTime().toString( KDateTime::ISODate ) ), +                 updated( atomNS, \
QLatin1String("updated"), KDateTime().toString( KDateTime::ISODate ) ), +             \
commentsCount( Syndication::slashNamespace(), QLatin1String("comments"), -1 ), +      \
commentsFeed( commentNS, QLatin1String("commentRss"), QString() ), +                 \
commentPostUri( commentNS, QLatin1String("comment"), QString() ), +                 \
commentsLink( krssNS, QLatin1String("commentsLink"), QString() ), +                 \
hash( krssNS, QLatin1String("hash"), 0 ), +                 guidIsHash( krssNS, \
QLatin1String("idIsHash"), false ), +                 sourceFeedId( krssNS, \
QLatin1String("sourceFeedId"), -1 ), +                 name( atomNS, \
QLatin1String("name"), QString() ), +                 uri( atomNS, \
QLatin1String("uri"), QString() ), +                 email( atomNS, \
QLatin1String("email"), QString() ), +                 author( atomNS, \
QLatin1String("author"), QString() ), +                 category( atomNS, \
QLatin1String("category"), QString() ), +                 customProperty( krssNS, \
QLatin1String("customProperty"), QString() ), +                 key( krssNS, \
QLatin1String("key"), QString() ), +                 value( krssNS, \
QLatin1String("value"), QString() ), +                 entry( atomNS, \
QLatin1String("entry"), QString() )  {}
     const QString atomNS;
     const QString krssNS;
@@ -179,17 +179,17 @@ static void writeLink( const QString& url, QXmlStreamWriter& \
writer )  if ( url.isEmpty() )
         return;
     Elements::instance.link.writeStartElement( writer );
-    writer.writeAttribute( "rel", "alternate" );
-    writeAttributeIfNotEmpty( "href", url, writer );
+    writer.writeAttribute( QLatin1String("rel"), QLatin1String("alternate") );
+    writeAttributeIfNotEmpty( QLatin1String("href"), url, writer );
     writer.writeEndElement();
 }
 
 static void writeCategory( const KRss::Category& category, QXmlStreamWriter& writer \
)  {
     Elements::instance.category.writeStartElement( writer );
-    writeAttributeIfNotEmpty( "term", category.term(), writer );
-    writeAttributeIfNotEmpty( "scheme", category.scheme(), writer );
-    writeAttributeIfNotEmpty( "label", category.label(), writer );
+    writeAttributeIfNotEmpty( QLatin1String("term"), category.term(), writer );
+    writeAttributeIfNotEmpty( QLatin1String("scheme"), category.scheme(), writer );
+    writeAttributeIfNotEmpty( QLatin1String("label"), category.label(), writer );
     writer.writeEndElement();
 }
 
@@ -206,14 +206,14 @@ static void writeAuthor( const KRss::Person& person, \
QXmlStreamWriter& writer )  static void writeEnclosure( const KRss::Enclosure& \
enclosure, QXmlStreamWriter& writer )  {
     Elements::instance.link.writeStartElement( writer );
-    writeAttributeIfNotEmpty( "rel", "enclosure", writer );
-    writeAttributeIfNotEmpty( "href", enclosure.url(), writer );
-    writeAttributeIfNotEmpty( "title", enclosure.title(), writer );
-    writeAttributeIfNotEmpty( "length", enclosure.length(), writer );
-    writeAttributeIfNotEmpty( "type", enclosure.type(), writer );
+    writeAttributeIfNotEmpty( QLatin1String("rel"), QLatin1String("enclosure"), \
writer ); +    writeAttributeIfNotEmpty( QLatin1String("href"), enclosure.url(), \
writer ); +    writeAttributeIfNotEmpty( QLatin1String("title"), enclosure.title(), \
writer ); +    writeAttributeIfNotEmpty( QLatin1String("length"), enclosure.length(), \
writer ); +    writeAttributeIfNotEmpty( QLatin1String("type"), enclosure.type(), \
writer );  const uint duration = enclosure.duration();
     if ( duration != 0 )
-        writer.writeAttribute( Syndication::itunesNamespace(), "duration", \
QString::number( duration ) ); +        writer.writeAttribute( \
Syndication::itunesNamespace(), QLatin1String("duration"), QString::number( duration \
) );  writer.writeEndElement();
 }
 
@@ -274,9 +274,9 @@ static void writeItem( const KRss::RssItem& item, \
QXmlStreamWriter& writer, KRss  const QString commentNS = \
Syndication::commentApiNamespace();  const QString krssNS = krssNamespace();
     writer.writeDefaultNamespace( atomNS );
-    writer.writeNamespace( commentNS, "comment" );
-    writer.writeNamespace( krssNS, "krss" );
-    writer.writeNamespace( Syndication::itunesNamespace(), "itunes" );
+    writer.writeNamespace( commentNS, QLatin1String("comment") );
+    writer.writeNamespace( krssNS, QLatin1String("krss") );
+    writer.writeNamespace( Syndication::itunesNamespace(), QLatin1String("itunes") \
);  
     Elements::instance.entry.writeStartElement( writer );
     if ( ( part & RssItemSerializer::Headers ) != 0 )
@@ -290,22 +290,22 @@ static void writeItem( const KRss::RssItem& item, \
QXmlStreamWriter& writer, KRss  static void readLink( KRss::RssItem& item, \
QXmlStreamReader& reader )  {
     const QXmlStreamAttributes attrs = reader.attributes();
-    const QString rel = attrs.value( QString(), "rel" ).toString();
-    if (  rel == "alternate" )
+    const QString rel = attrs.value( QString(), QLatin1String("rel") ).toString();
+    if (  rel == QLatin1String("alternate") )
     {
-        item.setLink( attrs.value( QString(), "href" ).toString() );
+        item.setLink( attrs.value( QString(), QLatin1String("href") ).toString() );
     }
-    else if ( rel == "enclosure" )
+    else if ( rel == QLatin1String("enclosure") )
     {
         KRss::Enclosure enc;
-        enc.setUrl( attrs.value( QString(), "href" ).toString() );
-        enc.setType( attrs.value( QString(), "type" ).toString() );
-        enc.setTitle( attrs.value( QString(), "title" ).toString() );
+        enc.setUrl( attrs.value( QString(), QLatin1String("href") ).toString() );
+        enc.setType( attrs.value( QString(), QLatin1String("type") ).toString() );
+        enc.setTitle( attrs.value( QString(), QLatin1String("title") ).toString() );
         bool ok;
-        const uint length = attrs.value( QString(), "length" ).toString().toUInt( \
&ok ); +        const uint length = attrs.value( QString(), QLatin1String("length") \
).toString().toUInt( &ok );  if ( ok )
             enc.setLength( length );
-        const uint duration = attrs.value( Syndication::itunesNamespace(), \
"duration" ).toString().toUInt( &ok ); +        const uint duration = attrs.value( \
Syndication::itunesNamespace(), QLatin1String("duration") ).toString().toUInt( &ok ); \
if ( ok )  enc.setDuration( duration );
         QList<KRss::Enclosure> encs = item.enclosures();
@@ -343,9 +343,9 @@ static void readCategory( KRss::RssItem& item, QXmlStreamReader& \
reader )  {
     const QXmlStreamAttributes attrs = reader.attributes();
     KRss::Category cat;
-    cat.setTerm( attrs.value( QString(), "term" ).toString() );
-    cat.setScheme( attrs.value( QString(), "scheme" ).toString() );
-    cat.setLabel( attrs.value( QString(), "label" ).toString() );
+    cat.setTerm( attrs.value( QString(), QLatin1String("term") ).toString() );
+    cat.setScheme( attrs.value( QString(), QLatin1String("scheme") ).toString() );
+    cat.setLabel( attrs.value( QString(), QLatin1String("label") ).toString() );
     QList<KRss::Category> cats = item.categories();
     cats.append( cat );
     item.setCategories( cats );
diff --git a/krss/subscriptionlabelscollectionattribute.cpp \
b/krss/subscriptionlabelscollectionattribute.cpp index 944f9d3..95fbd09 100644
--- a/krss/subscriptionlabelscollectionattribute.cpp
+++ b/krss/subscriptionlabelscollectionattribute.cpp
@@ -37,7 +37,7 @@ SubscriptionLabelsCollectionAttribute* \
SubscriptionLabelsCollectionAttribute::cl  
 QByteArray SubscriptionLabelsCollectionAttribute::serialized() const
 {
-        return m_subscriptionLabels.join( ";" ).toUtf8();
+        return m_subscriptionLabels.join( QLatin1String(";") ).toUtf8();
 }
 
 void SubscriptionLabelsCollectionAttribute::deserialize( const QByteArray &data )
@@ -46,7 +46,7 @@ void SubscriptionLabelsCollectionAttribute::deserialize( const \
QByteArray &data  return;
 
         // so ugly, am i missing something?
-        m_subscriptionLabels = QString::fromUtf8( data.constData(), data.size() \
).split( ';' ); +        m_subscriptionLabels = QString::fromUtf8( data.constData(), \
data.size() ).split( QLatin1Char(';') );  }
 
 QStringList SubscriptionLabelsCollectionAttribute::subscriptionLabels() const
diff --git a/krss/tag_p.h b/krss/tag_p.h
index 0295f2f..e7e2e14 100644
--- a/krss/tag_p.h
+++ b/krss/tag_p.h
@@ -170,7 +170,7 @@ public:
     void setLabel( const QString& label )
     {
         m_collection.attribute<TagPropertiesAttribute>( Collection::AddIfMissing \
                )->setLabel( label );
-        m_collection.setName( "rss-tag-" + label );
+        m_collection.setName( QLatin1String("rss-tag-") + label );
     }
 
     QString description() const
diff --git a/krss/tagidsattribute.cpp b/krss/tagidsattribute.cpp
index f4023bd..4192ca4 100644
--- a/krss/tagidsattribute.cpp
+++ b/krss/tagidsattribute.cpp
@@ -43,7 +43,7 @@ QByteArray TagIdsAttribute::serialized() const
         rawIds.append( Tag::idToString( tagId ) );
     }
 
-    return rawIds.join( ";" ).toUtf8();
+    return rawIds.join( QLatin1String(";") ).toUtf8();
 }
 
 void TagIdsAttribute::deserialize( const QByteArray& data )
@@ -52,7 +52,7 @@ void TagIdsAttribute::deserialize( const QByteArray& data )
         return;
 
     // so ugly, am i missing something?
-    const QStringList rawIds = QString::fromUtf8( data.constData(), data.size() \
).split( ';' ); +    const QStringList rawIds = QString::fromUtf8( data.constData(), \
data.size() ).split( QLatin1Char(';') );  Q_FOREACH( const QString& rawId, rawIds ) {
         m_tagIds.append( Tag::idFromString( rawId ) );
     }
diff --git a/krss/tests/feedcollectiontest.cpp b/krss/tests/feedcollectiontest.cpp
index 5d5499c..30f99a8 100644
--- a/krss/tests/feedcollectiontest.cpp
+++ b/krss/tests/feedcollectiontest.cpp
@@ -37,16 +37,16 @@ void FeedCollectionTest::testSimpleProperties()
 {
     FeedCollection feed;
 
-    feed.setTitle( "Planet KDE" );
-    QCOMPARE( feed.title(), QString( "Planet KDE" ) );
-    feed.setXmlUrl( "http://planetkde.org/rss20.xml" );
-    QCOMPARE( feed.xmlUrl(), QString( "http://planetkde.org/rss20.xml" ) );
-    feed.setHtmlUrl( "http://planetkde.org" );
-    QCOMPARE( feed.htmlUrl(), QString( "http://planetkde.org" ) );
-    feed.setDescription( "Planet KDE blogs" );
-    QCOMPARE( feed.description(), QString( "Planet KDE blogs" ) );
-    feed.setFeedType( "RSS" );
-    QCOMPARE( feed.feedType(), QString( "RSS" ) );
+    feed.setTitle( QLatin1String("Planet KDE") );
+    QCOMPARE( feed.title(), QLatin1String( "Planet KDE" ) );
+    feed.setXmlUrl( QLatin1String("http://planetkde.org/rss20.xml") );
+    QCOMPARE( feed.xmlUrl(), QLatin1String( "http://planetkde.org/rss20.xml" ) );
+    feed.setHtmlUrl( QLatin1String("http://planetkde.org") );
+    QCOMPARE( feed.htmlUrl(), QLatin1String( "http://planetkde.org" ) );
+    feed.setDescription( QLatin1String("Planet KDE blogs") );
+    QCOMPARE( feed.description(), QLatin1String( "Planet KDE blogs" ) );
+    feed.setFeedType( QLatin1String("RSS") );
+    QCOMPARE( feed.feedType(), QLatin1String( "RSS" ) );
 }
 
 // TODO(dmitry): proper tag handling
@@ -75,21 +75,21 @@ void FeedCollectionTest::testSubscriptionLabels()
 {
     FeedCollection feed;
 
-    feed.setSubscriptionLabels( QStringList() << "Label 1" << "Label 2" );
-    compareLists( feed.subscriptionLabels(), QStringList() << "Label 1" << "Label 2" \
                );
-    feed.addSubscriptionLabel( "Label 3" );
-    compareLists( feed.subscriptionLabels(), QStringList() << "Label 1" << "Label 2" \
                << "Label 3" );
-    feed.removeSubscriptionLabel( "Label 3" );
-    compareLists( feed.subscriptionLabels(), QStringList() << "Label 1" << "Label 2" \
); +    feed.setSubscriptionLabels( QStringList() << QLatin1String("Label 1") << \
QLatin1String("Label 2") ); +    compareLists( feed.subscriptionLabels(), \
QStringList() << QLatin1String("Label 1") << QLatin1String("Label 2") ); +    \
feed.addSubscriptionLabel( QLatin1String("Label 3") ); +    compareLists( \
feed.subscriptionLabels(), QStringList() << QLatin1String("Label 1") << \
QLatin1String("Label 2") << QLatin1String("Label 3") ); +    \
feed.removeSubscriptionLabel( QLatin1String("Label 3") ); +    compareLists( \
feed.subscriptionLabels(), QStringList() << QLatin1String("Label 1") << \
QLatin1String("Label 2") );  
     // check that FeedCollection doesn't produce dupes
-    feed.addSubscriptionLabel( "Label 1" );
-    compareLists( feed.subscriptionLabels(), QStringList() << "Label 1" << "Label 2" \
); +    feed.addSubscriptionLabel( QLatin1String("Label 1") );
+    compareLists( feed.subscriptionLabels(), QStringList() << QLatin1String("Label \
1") << QLatin1String("Label 2") );  
     // check that FeedCollection doesn't do weird things when
     // removing non-existing label
-    feed.removeSubscriptionLabel( "Empty label" );
-    compareLists( feed.subscriptionLabels(), QStringList() << "Label 1" << "Label 2" \
); +    feed.removeSubscriptionLabel( QLatin1String("Empty label") );
+    compareLists( feed.subscriptionLabels(), QStringList() << QLatin1String("Label \
1") << QLatin1String("Label 2") );  }
 
 void FeedCollectionTest::testCachePolicy()
diff --git a/krss/tests/tagprovidertest.cpp b/krss/tests/tagprovidertest.cpp
index a96e2ad..ff688de 100644
--- a/krss/tests/tagprovidertest.cpp
+++ b/krss/tests/tagprovidertest.cpp
@@ -48,8 +48,8 @@ void TagProviderTest::initTestCase()
 void TagProviderTest::createTagTest()
 {
     Tag tag;
-    tag.setLabel( "Test tag" );
-    tag.setDescription( "This is a test tag" );
+    tag.setLabel( QLatin1String("Test tag") );
+    tag.setDescription( QLatin1String("This is a test tag") );
 
     QSignalSpy spyCreateTag( m_tagProvider.get(), SIGNAL( tagCreated( const \
KRss::Tag& ) ) );  QVERIFY( spyCreateTag.isValid() );
@@ -80,8 +80,8 @@ void TagProviderTest::createTagTest()
 void TagProviderTest::createExistingTag()
 {
     Tag tag;
-    tag.setLabel( "Test tag" );
-    tag.setDescription( "This is a test tag" );
+    tag.setLabel( QLatin1String("Test tag") );
+    tag.setDescription( QLatin1String("This is a test tag") );
 
     QSignalSpy spyCreateTag( m_tagProvider.get(), SIGNAL( tagCreated( const \
KRss::Tag& ) ) );  QVERIFY( spyCreateTag.isValid() );
@@ -99,8 +99,8 @@ void TagProviderTest::createExistingTag()
 
 void TagProviderTest::modifyTagTest()
 {
-    m_tag.setLabel( "Modified test tag" );
-    m_tag.setDescription( "This was a test tag" );
+    m_tag.setLabel( QLatin1String("Modified test tag") );
+    m_tag.setDescription( QLatin1String("This was a test tag") );
 
     QSignalSpy spyModifyTag( m_tagProvider.get(), SIGNAL( tagModified( const \
KRss::Tag& ) ) );  QVERIFY( spyModifyTag.isValid() );
diff --git a/krss/tests/testitem.cpp b/krss/tests/testitem.cpp
index 70f5c3a..fe36e87 100644
--- a/krss/tests/testitem.cpp
+++ b/krss/tests/testitem.cpp
@@ -67,9 +67,9 @@ void TestItem::testSingleNullDates()
 void TestItem::testContentAndDescription()
 {
     // content() must return description() if no content is set
-    const QString desc1 = "Hello! I'm a description!";
-    const QString desc2 = "Hello! I'm another description!";
-    const QString content = "Hi there. Content is king!";
+    const QString desc1 = QLatin1String("Hello! I'm a description!");
+    const QString desc2 = QLatin1String("Hello! I'm another description!");
+    const QString content = QLatin1String("Hi there. Content is king!");
     Item item;
     item.setDescription( desc1 );
     QCOMPARE( item.description(), desc1 );
diff --git a/krss/tests/testxmlitemserializer.cpp \
b/krss/tests/testxmlitemserializer.cpp index 835683d..e0ce96b 100644
--- a/krss/tests/testxmlitemserializer.cpp
+++ b/krss/tests/testxmlitemserializer.cpp
@@ -87,13 +87,13 @@ void TestXmlItemSerializer::testDates()
 void TestXmlItemSerializer::testSimpleItems()
 {
     RssItem item;
-    item.setTitle( "Some title" );
-    item.setDescription( "Some description" );
-    item.setLink( "http://akregator.kde.org" );
-    item.setContent( "Content makes the world go round" );
-    item.setGuid( "http://uniqueid" );
+    item.setTitle( QLatin1String("Some title") );
+    item.setDescription( QLatin1String("Some description") );
+    item.setLink( QLatin1String("http://akregator.kde.org") );
+    item.setContent( QLatin1String("Content makes the world go round") );
+    item.setGuid( QLatin1String("http://uniqueid") );
     item.setGuidIsHash( true );
-    item.setLanguage( "en" );
+    item.setLanguage( QLatin1String("en") );
     item.setHash( 5 );
     ::testItem( item );
     item.setHash( 0 );
@@ -118,24 +118,24 @@ void TestXmlItemSerializer::testStatus()
 void TestXmlItemSerializer::testCustomProperties()
 {
     RssItem item;
-    item.setGuid( "http://uniqueid" );
-    item.setTitle( "Some title" );
-    item.setDescription( "Some description" );
-    item.setLink( "http://akregator.kde.org" );
-    item.setCustomProperty( "foo", "bar" );
-    item.setCustomProperty( "bar", "foo" );
-    item.setCustomProperty( "foobar", QString() );
+    item.setGuid( QLatin1String("http://uniqueid") );
+    item.setTitle( QLatin1String("Some title") );
+    item.setDescription( QLatin1String("Some description") );
+    item.setLink( QLatin1String("http://akregator.kde.org") );
+    item.setCustomProperty( QLatin1String("foo"), QLatin1String("bar") );
+    item.setCustomProperty( QLatin1String("bar"), QLatin1String("foo") );
+    item.setCustomProperty( QLatin1String("foobar"), QString() );
     ::testItem( item );
 }
 
 void TestXmlItemSerializer::testEnclosures()
 {
     RssItem item;
-    item.setLink( "http://akregator.kde.org" );
+    item.setLink( QLatin1String("http://akregator.kde.org") );
     Enclosure enc;
-    enc.setUrl( "http://akregator.kde.org/some.mp3" );
-    enc.setType( "audio/mpeg" );
-    enc.setTitle( "This is an enclosure!" );
+    enc.setUrl( QLatin1String("http://akregator.kde.org/some.mp3") );
+    enc.setType( QLatin1String("audio/mpeg") );
+    enc.setTitle( QLatin1String("This is an enclosure!") );
     enc.setLength( 123456789 );
     Enclosure enc2 = enc;
     enc.setDuration( 60 );
@@ -149,12 +149,12 @@ void TestXmlItemSerializer::testEnclosures()
 void TestXmlItemSerializer::testCategories()
 {
     Category cat;
-    cat.setTerm( "term1" );
-    cat.setScheme( "http://Blabla#" );
-    cat.setLabel( "Term 1" );
+    cat.setTerm( QLatin1String("term1") );
+    cat.setScheme( QLatin1String("http://Blabla#") );
+    cat.setLabel( QLatin1String("Term 1") );
     Category cat2;
-    cat2.setTerm( "Term2" );
-    cat2.setLabel( "Tada" );
+    cat2.setTerm( QLatin1String("Term2") );
+    cat2.setLabel( QLatin1String("Tada") );
     QList<Category> cats;
     cats.append( cat );
     cats.append( cat2 );
@@ -167,11 +167,11 @@ void TestXmlItemSerializer::testCategories()
 void TestXmlItemSerializer::testAuthors()
 {
     Person a1;
-    a1.setName( "John Doe" );
+    a1.setName( QLatin1String("John Doe") );
     Person a2;
-    a2.setName( "John Doe" );
-    a2.setUri( "http://doeweb.net/John" );
-    a2.setEmail( "joe@doeweb.net" );
+    a2.setName( QLatin1String("John Doe") );
+    a2.setUri( QLatin1String("http://doeweb.net/John") );
+    a2.setEmail( QLatin1String("joe@doeweb.net") );
     Person a3;
     QList<Person> authors;
     authors.append( a1 );
@@ -186,9 +186,9 @@ void TestXmlItemSerializer::testComments()
 {
     RssItem item;
     item.setCommentsCount( 10 );
-    item.setCommentsLink( "http://heyho#comment" );
-    item.setCommentsFeed( "http://heyho/comments.rss" );
-    item.setCommentPostUri( "http://whatever" );
+    item.setCommentsLink( QLatin1String("http://heyho#comment") );
+    item.setCommentsFeed( QLatin1String("http://heyho/comments.rss") );
+    item.setCommentPostUri( QLatin1String("http://whatever") );
     ::testItem( item );
 }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic