[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdepimlibs/kmime
From: Volker Krause <vkrause () kde ! org>
Date: 2007-09-30 20:53:45
Message-ID: 1191185625.309610.9443.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 719299 by vkrause:
Fix Content::indexForContent() and make ContentIndex usable in a QHash.
M +1 -1 kmime_content.cpp
M +6 -0 kmime_contentindex.cpp
M +2 -0 kmime_contentindex.h
M +1 -0 tests/contentindextest.cpp
--- trunk/KDE/kdepimlibs/kmime/kmime_content.cpp #719298:719299
@@ -1046,7 +1046,7 @@
ContentIndex KMime::Content::indexForContent( Content * content ) const
{
int i = d_ptr->contents.indexOf( content );
- if ( i > 0 ) {
+ if ( i >= 0 ) {
ContentIndex ci;
ci.push( i + 1 ); // zero-based -> one-based index
return ci;
--- trunk/KDE/kdepimlibs/kmime/kmime_contentindex.cpp #719298:719299
@@ -29,6 +29,7 @@
#include "kmime_contentindex.h"
+#include <QHash>
#include <QSharedData>
#include <QtCore/QStringList>
@@ -112,3 +113,8 @@
d = other.d;
return *this;
}
+
+uint qHash( const KMime::ContentIndex &index )
+{
+ return qHash( index.toString() );
+}
--- trunk/KDE/kdepimlibs/kmime/kmime_contentindex.h #719298:719299
@@ -134,4 +134,6 @@
} //namespace KMime
+KMIME_EXPORT uint qHash( const KMime::ContentIndex& );
+
#endif
--- trunk/KDE/kdepimlibs/kmime/tests/contentindextest.cpp #719298:719299
@@ -73,6 +73,7 @@
QCOMPARE( c1->content( ContentIndex( "2.1" ) ), (Content*)0 );
QCOMPARE( c1->indexForContent( c1 ), ContentIndex() );
QCOMPARE( c1->indexForContent( c11 ), ContentIndex( "2" ) );
+ QCOMPARE( c1->indexForContent( c1->contents().first() ), ContentIndex( "1" ) );
Content *c12 = new Content();
c1->addContent( c12 );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic