[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdepim/messagelist
From: Volker Krause <vkrause () kde ! org>
Date: 2010-11-13 12:36:00
Message-ID: 20101113123600.1D80CAC8A0 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1196428 by vkrause:
Store the source Akonadi item in MessageItem. This not only allows us to
get rid of a few other member variables, but also to return a full item
in Model::data(), so subsequent ItemModifyJobs run on them use the
correct item revision.
M +13 -13 core/messageitem.cpp
M +6 -3 core/messageitem.h
M +1 -1 core/model.cpp
M +1 -5 storagemodel.cpp
--- trunk/KDE/kdepim/messagelist/core/messageitem.cpp #1196427:1196428
@@ -24,6 +24,8 @@
#include "ontologies/email.h"
#include "messagecore/annotationdialog.h"
+#include <akonadi/item.h>
+
#include <Nepomuk/Resource>
#include <Nepomuk/Tag>
#include <Nepomuk/Variant>
@@ -152,10 +154,9 @@
QString mInReplyToIdMD5; ///< set only if we're doing threading
QString mReferencesIdMD5; ///< set only if we're doing threading
QString mStrippedSubjectMD5; ///< set only if we're doing threading
- QUrl mNepomukResourceUri; ///< The URI under which this item can be found \
in Nepomuk EncryptionState mEncryptionState;
SignatureState mSignatureState;
- unsigned long mUniqueId; ///< The unique id of this message (serial \
number of KMMsgBase at the moment of writing) + Akonadi::Item mAkonadiItem;
bool mAboutToBeRemoved : 1; ///< Set to true when this item is going to be \
deleted and shouldn't be selectable bool mSubjectIsPrefixed : 1; ///< set only \
if we're doing subject based threading @@ -194,7 +195,6 @@
MessageItem::Private::Private()
: mThreadingStatus( MessageItem::ParentMissing ),
- mUniqueId( 0 ),
mAboutToBeRemoved( false ),
mAnnotationStateChecked( false ),
mTagList( 0 )
@@ -238,7 +238,7 @@
// TODO: The tag pointers here could be shared between all items, there really is \
no point in // creating them for each item that has tags
- const Nepomuk::Resource resource( mNepomukResourceUri );
+ const Nepomuk::Resource resource( mAkonadiItem.url() );
const QList< Nepomuk::Tag > nepomukTagList = resource.tags();
if ( !nepomukTagList.isEmpty() ) {
foreach( const Nepomuk::Tag &nepomukTag, nepomukTagList ) {
@@ -308,7 +308,7 @@
if ( d->mAnnotationStateChecked )
return d->mHasAnnotation;
- Nepomuk::Resource resource( d->mNepomukResourceUri );
+ Nepomuk::Resource resource( d->mAkonadiItem.url() );
if ( resource.hasProperty( QUrl( Nepomuk::Resource::descriptionUri() ) ) ) {
d->mHasAnnotation = !resource.description().isEmpty();
} else {
@@ -322,7 +322,7 @@
QString MessageItem::annotation() const
{
if ( hasAnnotation() ) {
- Nepomuk::Resource resource( d->mNepomukResourceUri );
+ Nepomuk::Resource resource( d->mAkonadiItem.url() );
return resource.description();
}
else return QString();
@@ -330,7 +330,7 @@
void MessageItem::editAnnotation()
{
- MessageCore::AnnotationEditDialog *dialog = new MessageCore::AnnotationEditDialog( \
d->mNepomukResourceUri ); + MessageCore::AnnotationEditDialog *dialog = new \
MessageCore::AnnotationEditDialog( d->mAkonadiItem.url() ); dialog->setAttribute( \
Qt::WA_DeleteOnClose ); dialog->show();
// invalidate the cached mHasAnnotation value
@@ -339,7 +339,7 @@
QString MessageItem::contentSummary() const
{
- Nepomuk::Resource mail( d->mNepomukResourceUri );
+ Nepomuk::Resource mail( d->mAkonadiItem.url() );
const QString content =
mail.property( NepomukFast::Message::plainTextMessageContentUri() \
).toString();
@@ -546,17 +546,17 @@
unsigned long MessageItem::uniqueId() const
{
- return d->mUniqueId;
+ return d->mAkonadiItem.id();
}
-void MessageItem::setUniqueId( unsigned long uniqueId )
+Akonadi::Item MessageList::Core::MessageItem::akonadiItem() const
{
- d->mUniqueId = uniqueId;
+ return d->mAkonadiItem;
}
-void MessageItem::setNepomukResourceURI( const QUrl &nepomukUri )
+void MessageList::Core::MessageItem::setAkonadiItem(const Akonadi::Item& item)
{
- d->mNepomukResourceUri = nepomukUri;
+ d->mAkonadiItem = item;
}
MessageItem * MessageItem::topmostMessage()
--- trunk/KDE/kdepim/messagelist/core/messageitem.h #1196427:1196428
@@ -30,6 +30,10 @@
#include <messagelist/messagelist_export.h>
+namespace Akonadi {
+class Item;
+}
+
namespace MessageList
{
@@ -170,10 +174,9 @@
unsigned long uniqueId() const;
- void setUniqueId( unsigned long uniqueId );
+ Akonadi::Item akonadiItem() const;
+ void setAkonadiItem( const Akonadi::Item &item );
- void setNepomukResourceURI( const QUrl &nepomukUri );
-
MessageItem * topmostMessage();
/**
--- trunk/KDE/kdepim/messagelist/core/model.cpp #1196427:1196428
@@ -474,7 +474,7 @@
case Qt::UserRole + 2: //EntityTreeModel::ItemRole
if( item->type() == MessageList::Core::Item::Message ) {
MessageItem* mItem = static_cast<MessageItem*>( item );
- return QVariant::fromValue( Akonadi::Item( mItem->uniqueId() ) );
+ return QVariant::fromValue( mItem->akonadiItem() );
} else
return QVariant();
break;
--- trunk/KDE/kdepim/messagelist/storagemodel.cpp #1196427:1196428
@@ -252,12 +252,8 @@
sender, receiver,
bUseReceiver ? receiver : sender );
- mi->setUniqueId( item.id() );
+ mi->setAkonadiItem( item );
- // Storing the Nepomuk resource URI could be avoided, since we already store the \
item ID, but that
- // would mean that MessageItem needs to depend on Akonadi, which we don't want \
(yet?)
- mi->setNepomukResourceURI( item.url() );
-
QString subject = mail->subject()->asUnicodeString();
if ( subject.isEmpty() ) {
subject = QLatin1Char( '(' ) + noSubject + QLatin1Char( ')' );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic