• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

messagelist

  • sources
  • kde-4.14
  • kdepim
  • messagelist
storagemodel.cpp
Go to the documentation of this file.
1 /*
2  Copyright (c) 2009 Kevin Ottens <ervin@kde.org>
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18 
19 #include "storagemodel.h"
20 
21 #include <messagecore/utils/stringutil.h>
22 #include <messagecore/settings/globalsettings.h>
23 #include <messagecore/helpers/nodehelper.h>
24 
25 #include <akonadi/attributefactory.h>
26 #include <akonadi/collection.h>
27 #include <akonadi/collectionstatistics.h>
28 #include <akonadi/entitymimetypefiltermodel.h>
29 #include <akonadi/entitytreemodel.h>
30 #include <akonadi/item.h>
31 #include <akonadi/itemmodifyjob.h>
32 #include <akonadi/kmime/messagefolderattribute.h>
33 #include <akonadi/selectionproxymodel.h>
34 
35 #include <KDE/KLocale>
36 #include "core/messageitem.h"
37 #include "core/settings.h"
38 #include "messagelistutil.h"
39 
40 
41 #include <QtCore/QAbstractItemModel>
42 #include <QtCore/QAtomicInt>
43 #include <QtCore/QScopedPointer>
44 #include <QItemSelectionModel>
45 #include <QtCore/QMimeData>
46 #include <QtCore/QCryptographicHash>
47 
48 namespace MessageList
49 {
50 
51 class StorageModel::Private
52 {
53 public:
54  void onSourceDataChanged( const QModelIndex &topLeft, const QModelIndex &bottomRight );
55  void onSelectionChanged();
56  void loadSettings();
57 
58  StorageModel * const q;
59 
60  QAbstractItemModel *mModel;
61  QAbstractItemModel *mChildrenFilterModel;
62  QItemSelectionModel *mSelectionModel;
63 
64  Private( StorageModel *owner )
65  : q( owner ),
66  mModel(0),
67  mSelectionModel(0)
68  {}
69 };
70 
71 } // namespace MessageList
72 
73 using namespace Akonadi;
74 using namespace MessageList;
75 
76 namespace {
77 
78 KMime::Message::Ptr messageForItem( const Akonadi::Item &item )
79 {
80  if ( !item.hasPayload<KMime::Message::Ptr>() ) {
81  kWarning() << "Not a message" << item.id() << item.remoteId() << item.mimeType();
82  return KMime::Message::Ptr();
83  }
84  return item.payload<KMime::Message::Ptr>();
85 }
86 
87 }
88 
89 static QAtomicInt _k_attributeInitialized;
90 
91 StorageModel::StorageModel( QAbstractItemModel *model, QItemSelectionModel *selectionModel, QObject *parent )
92  : Core::StorageModel( parent ), d( new Private( this ) )
93 {
94  d->mSelectionModel = selectionModel;
95  if ( _k_attributeInitialized.testAndSetAcquire( 0, 1 ) ) {
96  AttributeFactory::registerAttribute<MessageFolderAttribute>();
97  }
98 
99  Akonadi::SelectionProxyModel *childrenFilter = new Akonadi::SelectionProxyModel( d->mSelectionModel, this );
100  childrenFilter->setSourceModel( model );
101  childrenFilter->setFilterBehavior( KSelectionProxyModel::ChildrenOfExactSelection );
102  d->mChildrenFilterModel = childrenFilter;
103 
104  EntityMimeTypeFilterModel *itemFilter = new EntityMimeTypeFilterModel( this );
105  itemFilter->setSourceModel( childrenFilter );
106  itemFilter->addMimeTypeExclusionFilter( Collection::mimeType() );
107  itemFilter->addMimeTypeInclusionFilter( QLatin1String( "message/rfc822" ) );
108  itemFilter->setHeaderGroup( EntityTreeModel::ItemListHeaders );
109 
110  d->mModel = itemFilter;
111 
112  kDebug() << "Using model:" << model->metaObject()->className();
113 
114  connect( d->mModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
115  this, SLOT(onSourceDataChanged(QModelIndex,QModelIndex)) );
116 
117  connect( d->mModel, SIGNAL(layoutAboutToBeChanged()),
118  this, SIGNAL(layoutAboutToBeChanged()) );
119  connect( d->mModel, SIGNAL(layoutChanged()),
120  this, SIGNAL(layoutChanged()) );
121  connect( d->mModel, SIGNAL(modelAboutToBeReset()),
122  this, SIGNAL(modelAboutToBeReset()) );
123  connect( d->mModel, SIGNAL(modelReset()),
124  this, SIGNAL(modelReset()) );
125 
126  //Here we assume we'll always get QModelIndex() in the parameters
127  connect( d->mModel, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)),
128  this, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)) );
129  connect( d->mModel, SIGNAL(rowsInserted(QModelIndex,int,int)),
130  this, SIGNAL(rowsInserted(QModelIndex,int,int)) );
131  connect( d->mModel, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
132  this, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)) );
133  connect( d->mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)),
134  this, SIGNAL(rowsRemoved(QModelIndex,int,int)) );
135 
136  connect( d->mSelectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
137  this, SLOT(onSelectionChanged()) );
138 
139  d->loadSettings();
140  connect( Core::Settings::self(), SIGNAL(configChanged()),
141  this, SLOT(loadSettings()) );
142 }
143 
144 StorageModel::~StorageModel()
145 {
146  delete d;
147 }
148 
149 Collection::List StorageModel::displayedCollections() const
150 {
151  Collection::List collections;
152  QModelIndexList indexes = d->mSelectionModel->selectedRows();
153 
154  foreach ( const QModelIndex &index, indexes ) {
155  Collection c = index.data( EntityTreeModel::CollectionRole ).value<Collection>();
156  if ( c.isValid() ) {
157  collections << c;
158  }
159  }
160 
161  return collections;
162 }
163 
164 QString StorageModel::id() const
165 {
166  QStringList ids;
167  QModelIndexList indexes = d->mSelectionModel->selectedRows();
168 
169  foreach ( const QModelIndex &index, indexes ) {
170  Collection c = index.data( EntityTreeModel::CollectionRole ).value<Collection>();
171  if ( c.isValid() ) {
172  ids << QString::number( c.id() );
173  }
174  }
175 
176  ids.sort();
177  return ids.join(QLatin1String( ":" ));
178 }
179 
180 bool StorageModel::isOutBoundFolder( const Akonadi::Collection& c ) const
181 {
182  if ( c.hasAttribute<MessageFolderAttribute>()
183  && c.attribute<MessageFolderAttribute>()->isOutboundFolder() ) {
184  return true;
185  }
186  return false;
187 }
188 
189 bool StorageModel::containsOutboundMessages() const
190 {
191  QModelIndexList indexes = d->mSelectionModel->selectedRows();
192 
193  foreach ( const QModelIndex &index, indexes ) {
194  Collection c = index.data( EntityTreeModel::CollectionRole ).value<Collection>();
195  if ( c.isValid() ) {
196  return isOutBoundFolder( c );
197  }
198  }
199 
200  return false;
201 }
202 
203 int StorageModel::initialUnreadRowCountGuess() const
204 {
205  QModelIndexList indexes = d->mSelectionModel->selectedRows();
206 
207  int unreadCount = 0;
208 
209  foreach ( const QModelIndex &index, indexes ) {
210  Collection c = index.data( EntityTreeModel::CollectionRole ).value<Collection>();
211  if ( c.isValid() ) {
212  unreadCount+= c.statistics().unreadCount();
213  }
214  }
215 
216  return unreadCount;
217 }
218 
219 bool StorageModel::initializeMessageItem( MessageList::Core::MessageItem *mi,
220  int row, bool bUseReceiver ) const
221 {
222  const Item item = itemForRow( row );
223  const KMime::Message::Ptr mail = messageForItem( item );
224  if ( !mail ) {
225  return false;
226  }
227 
228  const Collection parentCol = parentCollectionForRow( row );
229 
230  QString sender;
231  if ( mail->from() ) {
232  sender = mail->from()->asUnicodeString();
233  }
234  QString receiver;
235  if ( mail->to() ) {
236  receiver = mail->to()->asUnicodeString();
237  }
238 
239  // Static for speed reasons
240  static const QString noSubject = i18nc( "displayed as subject when the subject of a mail is empty", "No Subject" );
241  static const QString unknown( i18nc( "displayed when a mail has unknown sender, receiver or date", "Unknown" ) );
242 
243  if ( sender.isEmpty() ) {
244  sender = unknown;
245  }
246  if ( receiver.isEmpty() ) {
247  receiver = unknown;
248  }
249 
250  mi->initialSetup( mail->date()->dateTime().toTime_t(),
251  item.size(),
252  sender, receiver,
253  bUseReceiver );
254  mi->setItemId( item.id() );
255  mi->setParentCollectionId( parentCol.id() );
256 
257  QString subject = mail->subject()->asUnicodeString();
258  if ( subject.isEmpty() ) {
259  subject = QLatin1Char( '(' ) + noSubject + QLatin1Char( ')' );
260  }
261 
262  mi->setSubject( subject );
263 
264  updateMessageItemData( mi, row );
265 
266  return true;
267 }
268 
269 static QByteArray md5Encode( const QByteArray &str )
270 {
271  if ( str.trimmed().isEmpty() ) return QByteArray();
272 
273  QCryptographicHash c( QCryptographicHash::Md5 );
274  c.addData( str.trimmed() );
275  return c.result();
276 }
277 
278 void StorageModel::fillMessageItemThreadingData( MessageList::Core::MessageItem *mi,
279  int row, ThreadingDataSubset subset ) const
280 {
281  const KMime::Message::Ptr mail = messageForRow( row );
282  Q_ASSERT( mail ); // We ASSUME that initializeMessageItem has been called successfully...
283 
284  switch ( subset ) {
285  case PerfectThreadingReferencesAndSubject:
286  {
287  const QString subject = mail->subject()->asUnicodeString();
288  const QString strippedSubject = MessageCore::StringUtil::stripOffPrefixes( subject );
289  mi->setStrippedSubjectMD5( md5Encode( strippedSubject.toUtf8() ) );
290  mi->setSubjectIsPrefixed( subject != strippedSubject );
291  // fall through
292  }
293  case PerfectThreadingPlusReferences:
294  if ( !mail->references()->identifiers().isEmpty() ) {
295  mi->setReferencesIdMD5( md5Encode( mail->references()->identifiers().last() ) );
296  }
297  // fall through
298  case PerfectThreadingOnly:
299  mi->setMessageIdMD5( md5Encode( mail->messageID()->identifier() ) );
300  if ( !mail->inReplyTo()->identifiers().isEmpty() ) {
301  mi->setInReplyToIdMD5( md5Encode( mail->inReplyTo()->identifiers().first() ) );
302  }
303  break;
304  default:
305  Q_ASSERT( false ); // should never happen
306  break;
307  }
308 }
309 
310 void StorageModel::updateMessageItemData( MessageList::Core::MessageItem *mi,
311  int row ) const
312 {
313  const Item item = itemForRow( row );
314 
315  Akonadi::MessageStatus stat;
316  stat.setStatusFromFlags( item.flags() );
317 
318  mi->setAkonadiItem( item );
319  mi->setStatus( stat );
320 
321 
322  if ( stat.isEncrypted() )
323  mi->setEncryptionState( Core::MessageItem::FullyEncrypted );
324  else
325  mi->setEncryptionState( Core::MessageItem::EncryptionStateUnknown );
326 
327 
328  if ( stat.isSigned() )
329  mi->setSignatureState( Core::MessageItem::FullySigned );
330  else
331  mi->setSignatureState( Core::MessageItem::SignatureStateUnknown );
332 
333  mi->invalidateTagCache();
334  mi->invalidateAnnotationCache();
335 }
336 
337 void StorageModel::setMessageItemStatus( MessageList::Core::MessageItem *mi,
338  int row, const Akonadi::MessageStatus &status )
339 {
340  Q_UNUSED( mi );
341  Item item = itemForRow( row );
342  item.setFlags( status.statusFlags() );
343  ItemModifyJob *job = new ItemModifyJob( item, this );
344  job->disableRevisionCheck();
345  job->setIgnorePayload( true );
346 }
347 
348 QVariant StorageModel::data( const QModelIndex &index, int role ) const
349 {
350  // We don't provide an implementation for data() in No-Akonadi-KMail.
351  // This is because StorageModel must be a wrapper anyway (because columns
352  // must be re-mapped and functions not available in a QAbstractItemModel
353  // are strictly needed. So when porting to Akonadi this class will
354  // either wrap or subclass the MessageModel and implement initializeMessageItem()
355  // with appropriate calls to data(). And for No-Akonadi-KMail we still have
356  // a somewhat efficient implementation.
357 
358  Q_UNUSED( index );
359  Q_UNUSED( role );
360 
361  return QVariant();
362 }
363 
364 int StorageModel::columnCount( const QModelIndex &parent ) const
365 {
366  if ( !parent.isValid() )
367  return 1;
368  return 0; // this model is flat.
369 }
370 
371 QModelIndex StorageModel::index( int row, int column, const QModelIndex &parent ) const
372 {
373  if ( !parent.isValid() )
374  return createIndex( row, column, 0 );
375 
376  return QModelIndex(); // this model is flat.
377 }
378 
379 QModelIndex StorageModel::parent( const QModelIndex &index ) const
380 {
381  Q_UNUSED( index );
382  return QModelIndex(); // this model is flat.
383 }
384 
385 int StorageModel::rowCount( const QModelIndex &parent ) const
386 {
387  if ( !parent.isValid() )
388  return d->mModel->rowCount();
389  return 0; // this model is flat.
390 }
391 
392 QMimeData* StorageModel::mimeData( const QList< MessageList::Core::MessageItem* >& items ) const
393 {
394  QMimeData *data = new QMimeData();
395  KUrl::List urls;
396  foreach ( MessageList::Core::MessageItem* mi, items ) {
397  Akonadi::Item item = itemForRow( mi->currentModelIndexRow() );
398  urls << item.url( Item::UrlWithMimeType );
399  }
400 
401  urls.populateMimeData( data );
402 
403  return data;
404 }
405 
406 
407 void StorageModel::prepareForScan()
408 {
409 
410 }
411 
412 void StorageModel::Private::onSourceDataChanged( const QModelIndex &topLeft, const QModelIndex &bottomRight )
413 {
414  emit q->dataChanged( q->index( topLeft.row(), 0 ),
415  q->index( bottomRight.row(), 0 ) );
416 }
417 
418 void StorageModel::Private::onSelectionChanged()
419 {
420  emit q->headerDataChanged( Qt::Horizontal, 0, q->columnCount()-1 );
421 }
422 
423 void StorageModel::Private::loadSettings()
424 {
425  // Custom/System colors
426  Core::Settings *settings = Core::Settings::self();
427 
428  if ( MessageCore::GlobalSettings::self()->useDefaultColors() ) {
429  Core::MessageItem::setUnreadMessageColor( MessageList::Util::unreadDefaultMessageColor() );
430  Core::MessageItem::setImportantMessageColor( MessageList::Util::importantDefaultMessageColor() );
431  Core::MessageItem::setToDoMessageColor( MessageList::Util::todoDefaultMessageColor() );
432  } else {
433  Core::MessageItem::setUnreadMessageColor( settings->unreadMessageColor() );
434  Core::MessageItem::setImportantMessageColor( settings->importantMessageColor() );
435  Core::MessageItem::setToDoMessageColor( settings->todoMessageColor() );
436  }
437 
438  if ( MessageCore::GlobalSettings::self()->useDefaultFonts() ) {
439  Core::MessageItem::setGeneralFont( KGlobalSettings::generalFont() );
440  Core::MessageItem::setUnreadMessageFont( KGlobalSettings::generalFont() );
441  Core::MessageItem::setImportantMessageFont( KGlobalSettings::generalFont() );
442  Core::MessageItem::setToDoMessageFont( KGlobalSettings::generalFont() );
443  } else {
444  Core::MessageItem::setGeneralFont( settings->messageListFont() );
445  Core::MessageItem::setUnreadMessageFont( settings->unreadMessageFont() );
446  Core::MessageItem::setImportantMessageFont( settings->importantMessageFont() );
447  Core::MessageItem::setToDoMessageFont( settings->todoMessageFont() );
448  }
449 }
450 
451 Item StorageModel::itemForRow( int row ) const
452 {
453  return d->mModel->data( d->mModel->index( row, 0 ), EntityTreeModel::ItemRole ).value<Item>();
454 }
455 
456 KMime::Message::Ptr StorageModel::messageForRow( int row ) const
457 {
458  return messageForItem( itemForRow( row ) );
459 }
460 
461 Collection StorageModel::parentCollectionForRow(int row) const
462 {
463  QAbstractProxyModel *mimeProxy = static_cast<QAbstractProxyModel*>( d->mModel );
464  // This is index mapped to Akonadi::SelectionProxyModel
465  const QModelIndex childrenFilterIndex = mimeProxy->mapToSource( d->mModel->index( row, 0 ) );
466  Q_ASSERT( childrenFilterIndex.isValid() );
467 
468  QAbstractProxyModel *childrenProxy = static_cast<QAbstractProxyModel*>( d->mChildrenFilterModel );
469  // This is index mapped to ETM
470  const QModelIndex etmIndex = childrenProxy->mapToSource( childrenFilterIndex );
471  Q_ASSERT( etmIndex.isValid() );
472  // We cannot possibly refer to top-level collection
473  Q_ASSERT( etmIndex.parent().isValid() );
474 
475  const Collection col = etmIndex.parent().data( EntityTreeModel::CollectionRole ).value<Collection>();
476  Q_ASSERT( col.isValid() );
477 
478  return col;
479 }
480 
481 void StorageModel::resetModelStorage()
482 {
483  reset();
484 }
485 
486 #include "moc_storagemodel.cpp"
MessageList::StorageModel::messageForRow
KMime::Message::Ptr messageForRow(int row) const
Definition: storagemodel.cpp:456
QModelIndex
MessageList::StorageModel::initializeMessageItem
virtual bool initializeMessageItem(MessageList::Core::MessageItem *mi, int row, bool bUseReceiver) const
This method should use the inner model implementation to fill in the base data for the specified Mess...
Definition: storagemodel.cpp:219
MessageList::StorageModel::containsOutboundMessages
virtual bool containsOutboundMessages() const
Returns true if this StorageModel (folder) contains outbound messages and false otherwise.
Definition: storagemodel.cpp:189
QAbstractItemModel::layoutChanged
void layoutChanged()
MessageList::Core::MessageItem::setUnreadMessageColor
static void setUnreadMessageColor(const QColor &color)
Definition: messageitem.cpp:623
QByteArray::trimmed
QByteArray trimmed() const
QAbstractProxyModel
QByteArray
MessageList::Core::MessageItem
Definition: messageitem.h:46
MessageList::StorageModel::parentCollectionForRow
Akonadi::Collection parentCollectionForRow(int row) const
Definition: storagemodel.cpp:461
MessageList::Util::importantDefaultMessageColor
MESSAGELIST_EXPORT QColor importantDefaultMessageColor()
Definition: messagelistutil.cpp:112
QObject::sender
QObject * sender() const
MessageList::StorageModel::initialUnreadRowCountGuess
virtual int initialUnreadRowCountGuess() const
Returns (a guess for) the number of unread messages: must be pessimistic (i.e.
Definition: storagemodel.cpp:203
MessageList::Core::MessageItem::setImportantMessageColor
static void setImportantMessageColor(const QColor &color)
Definition: messageitem.cpp:629
MessageList::StorageModel::fillMessageItemThreadingData
virtual void fillMessageItemThreadingData(MessageList::Core::MessageItem *mi, int row, ThreadingDataSubset subset) const
This method should use the inner model implementation to fill in the specified subset of threading da...
Definition: storagemodel.cpp:278
QByteArray::isEmpty
bool isEmpty() const
MessageList::Core::MessageItem::setStrippedSubjectMD5
void setStrippedSubjectMD5(const QByteArray &md5)
Definition: messageitem.cpp:504
QObject::metaObject
virtual const QMetaObject * metaObject() const
QVariant::value
T value() const
MessageList::Core::MessageItem::setMessageIdMD5
void setMessageIdMD5(const QByteArray &md5)
Definition: messageitem.cpp:456
MessageList::Core::MessageItem::setAkonadiItem
void setAkonadiItem(const Akonadi::Item &item)
Definition: messageitem.cpp:546
QAbstractItemModel::modelAboutToBeReset
void modelAboutToBeReset()
MessageList::StorageModel::rowCount
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
Definition: storagemodel.cpp:385
QAbstractItemModel::modelReset
void modelReset()
MessageList::Core::Item::setSubject
void setSubject(const QString &subject)
Sets the subject associated to this Item.
Definition: item.cpp:476
QAtomicInt::testAndSetAcquire
bool testAndSetAcquire(int expectedValue, int newValue)
QStringList::join
QString join(const QString &separator) const
MessageList::Core::Item::setItemId
void setItemId(qint64 id)
Definition: item.cpp:494
QAbstractItemModel::rowsAboutToBeRemoved
void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
QMimeData
MessageList::Core::MessageItem::setToDoMessageFont
static void setToDoMessageFont(const QFont &font)
Definition: messageitem.cpp:659
MessageList::Core::StorageModel::ThreadingDataSubset
ThreadingDataSubset
Definition: storagemodelbase.h:95
MessageList::StorageModel::columnCount
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const
Definition: storagemodel.cpp:364
MessageList::StorageModel::updateMessageItemData
virtual void updateMessageItemData(MessageList::Core::MessageItem *mi, int row) const
This method should use the inner model implementation to re-fill the date, the status, the encryption state, the signature state and eventually update the min/max dates for the specified MessageItem from the underlying storage slot at the specified row index.
Definition: storagemodel.cpp:310
md5Encode
static QByteArray md5Encode(const QByteArray &str)
Definition: storagemodel.cpp:269
QAbstractItemModel::layoutAboutToBeChanged
void layoutAboutToBeChanged()
MessageList::StorageModel::displayedCollections
Akonadi::Collection::List displayedCollections() const
Definition: storagemodel.cpp:149
MessageList::Core::MessageItem::setInReplyToIdMD5
void setInReplyToIdMD5(const QByteArray &md5)
Definition: messageitem.cpp:468
QAbstractItemModel::reset
void reset()
QModelIndex::isValid
bool isValid() const
QString::number
QString number(int n, int base)
QAbstractItemModel::rowsAboutToBeInserted
void rowsAboutToBeInserted(const QModelIndex &parent, int start, int end)
messageitem.h
QAbstractItemModel::dataChanged
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
QObject
storagemodel.h
MessageList::Core::MessageItem::setEncryptionState
void setEncryptionState(EncryptionState state)
Definition: messageitem.cpp:444
QString::isEmpty
bool isEmpty() const
QModelIndex::row
int row() const
MessageList::Core::MessageItem::setReferencesIdMD5
void setReferencesIdMD5(const QByteArray &md5)
Definition: messageitem.cpp:480
QCryptographicHash::addData
void addData(const char *data, int length)
QAtomicInt
MessageList::StorageModel::resetModelStorage
void resetModelStorage()
Definition: storagemodel.cpp:481
QString
QList< MessageList::Core::MessageItem * >
MessageList::Core::ModelInvariantIndex::currentModelIndexRow
int currentModelIndexRow()
Returns the current model index row for this invariant index.
Definition: modelinvariantindex.cpp:47
QModelIndex::parent
QModelIndex parent() const
QAbstractItemModel::rowsRemoved
void rowsRemoved(const QModelIndex &parent, int start, int end)
MessageList::StorageModel::prepareForScan
virtual void prepareForScan()
Called by Model just before this StorageModel is attacched to it.
Definition: storagemodel.cpp:407
MessageList::Core::StorageModel::PerfectThreadingPlusReferences
messageIdMD5, inReplyToMD5, referencesIdMD5
Definition: storagemodelbase.h:98
MessageList::StorageModel::isOutBoundFolder
virtual bool isOutBoundFolder(const Akonadi::Collection &c) const
Definition: storagemodel.cpp:180
MessageList::Core::MessageItem::setSignatureState
void setSignatureState(SignatureState state)
Definition: messageitem.cpp:432
MessageList::Core::MessageItem::invalidateTagCache
void invalidateTagCache()
Deletes all cached tags.
Definition: messageitem.cpp:324
QStringList
QAbstractItemModel::createIndex
QModelIndex createIndex(int row, int column, void *ptr) const
MessageList::Util::todoDefaultMessageColor
MESSAGELIST_EXPORT QColor todoDefaultMessageColor()
Definition: messagelistutil.cpp:117
_k_attributeInitialized
static QAtomicInt _k_attributeInitialized
Definition: storagemodel.cpp:89
QLatin1Char
MessageList::Core::Item::setParentCollectionId
void setParentCollectionId(qint64 id)
Definition: item.cpp:504
QMetaObject::className
const char * className() const
MessageList::StorageModel::index
virtual QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Definition: storagemodel.cpp:371
MessageList::Core::MessageItem::setSubjectIsPrefixed
void setSubjectIsPrefixed(bool subjectIsPrefixed)
Definition: messageitem.cpp:486
QItemSelection
MessageList::Core::MessageItem::setUnreadMessageFont
static void setUnreadMessageFont(const QFont &font)
Definition: messageitem.cpp:647
MessageList::Core::MessageItem::setImportantMessageFont
static void setImportantMessageFont(const QFont &font)
Definition: messageitem.cpp:653
MessageList::Core::MessageItem::setToDoMessageColor
static void setToDoMessageColor(const QColor &color)
Definition: messageitem.cpp:635
MessageList::Util::unreadDefaultMessageColor
MESSAGELIST_EXPORT QColor unreadDefaultMessageColor()
Definition: messagelistutil.cpp:107
messagelistutil.h
MessageList::StorageModel::data
virtual QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
Definition: storagemodel.cpp:348
QModelIndex::data
QVariant data(int role) const
MessageList::Core::MessageItem::EncryptionStateUnknown
Definition: messageitem.h:85
QLatin1String
MessageList::StorageModel::mimeData
virtual QMimeData * mimeData(const QList< MessageList::Core::MessageItem * > &) const
The implementation-specific mime data for this list of items.
Definition: storagemodel.cpp:392
MessageList::StorageModel::setMessageItemStatus
virtual void setMessageItemStatus(MessageList::Core::MessageItem *mi, int row, const Akonadi::MessageStatus &status)
This method should use the inner model implementation to associate the new status to the specified me...
Definition: storagemodel.cpp:337
QCryptographicHash
MessageList::Core::StorageModel::PerfectThreadingReferencesAndSubject
All of the above plus subject stuff.
Definition: storagemodelbase.h:99
MessageList::StorageModel
The Akonadi specific implementation of the Core::StorageModel.
Definition: storagemodel.h:48
QAbstractItemModel
QCryptographicHash::result
QByteArray result() const
MessageList::Core::MessageItem::SignatureStateUnknown
Definition: messageitem.h:93
QStringList::sort
void sort()
MessageList::Core::MessageItem::setGeneralFont
static void setGeneralFont(const QFont &font)
Definition: messageitem.cpp:641
QAbstractItemModel::rowsInserted
void rowsInserted(const QModelIndex &parent, int start, int end)
QItemSelectionModel
MessageList::Core::MessageItem::FullyEncrypted
Definition: messageitem.h:84
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QAbstractProxyModel::mapToSource
virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const =0
QObject::parent
QObject * parent() const
MessageList::StorageModel::itemForRow
Akonadi::Item itemForRow(int row) const
Definition: storagemodel.cpp:451
MessageList::Core::Item::initialSetup
void initialSetup(time_t date, size_t size, const QString &sender, const QString &receiver, bool useReceiver)
This is meant to be called right after the constructor.
Definition: item.cpp:481
MessageList::StorageModel::id
virtual QString id() const
Returns an unique id for this Storage collection.
Definition: storagemodel.cpp:164
MessageList::Core::StorageModel::PerfectThreadingOnly
Only the data for messageIdMD5 and inReplyToMD5 is needed.
Definition: storagemodelbase.h:97
MessageList::Core::MessageItem::invalidateAnnotationCache
void invalidateAnnotationCache()
Same as invalidateTagCache(), only for the annotation.
Definition: messageitem.cpp:330
MessageList::StorageModel::~StorageModel
~StorageModel()
Definition: storagemodel.cpp:144
QVariant
QString::toUtf8
QByteArray toUtf8() const
MessageList::Core::MessageItem::FullySigned
Definition: messageitem.h:92
MessageList::Core::Item::setStatus
void setStatus(const Akonadi::MessageStatus &status)
Sets the status associated to this Item.
Definition: item.cpp:406
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:32:01 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

messagelist

Skip menu "messagelist"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal