messagelist
model.cpp
Go to the documentation of this file.
209 ViewItemJob( int startIndex, int endIndex, int chunkTimeout, int idleInterval, int messageCheckCount, bool disconnectUI = false )
219 ViewItemJob( Pass pass, QList< ModelInvariantIndex * > * invariantIndexList, int chunkTimeout, int idleInterval, int messageCheckCount )
299 d->mCachedWatchedOrIgnoredStatusBits = Akonadi::MessageStatus::statusIgnored().toQInt32() | Akonadi::MessageStatus::statusWatched().toQInt32();
530 // FIXME: This function is a bottleneck (the caching in indexOfChildItem only works 30% of the time)
552 return QModelIndex(); // senseless column (we could optimize by skipping this check but ModelTest from trolltech is pedantic)
566 return QModelIndex(); // parent column is not 0: shouldn't have children (as per Qt documentation)
744 // adjusted by the second job. For instance, in my kernel mailing list folder this "smart" approach
816 if ( ( !canDoJobWithDisconnectedUI ) && ( d->mStorageModel->rowCount() > 3000 ) ) // empiric value
818 // First a small job with the most recent messages. Large chunk, small (but non zero) idle interval
820 ViewItemJob * job1 = new ViewItemJob( d->mStorageModel->rowCount() - 1000, d->mStorageModel->rowCount() - 1, 200, 20, 100, canDoFirstSmallChunkWithDisconnectedUI );
822 // Then a larger job with older messages. Small chunk, bigger idle interval, small number of messages to
824 ViewItemJob * job2 = new ViewItemJob( 0, d->mStorageModel->rowCount() - 1001, 100, 50, 10, false );
833 ViewItemJob * job = new ViewItemJob( 0, d->mStorageModel->rowCount() - 1, 150, 30, 30, canDoJobWithDisconnectedUI );
839 if ( ( !canDoJobWithDisconnectedUI ) && ( d->mStorageModel->rowCount() > 3000 ) ) // empiric value
842 ViewItemJob * job1 = new ViewItemJob( d->mStorageModel->rowCount() - 1000, d->mStorageModel->rowCount() - 1, 250, 0, 100, canDoFirstSmallChunkWithDisconnectedUI );
844 ViewItemJob * job2 = new ViewItemJob( 0, d->mStorageModel->rowCount() - 1001, 200, 0, 10, false );
849 ViewItemJob * job = new ViewItemJob( 0, d->mStorageModel->rowCount() - 1, 250, 0, 100, canDoJobWithDisconnectedUI );
856 ViewItemJob * job = new ViewItemJob( 0, d->mStorageModel->rowCount() - 1, 60000, 0, 100000, canDoJobWithDisconnectedUI );
873 // This function is called by MessageList::Core::Manager once in a while (every 1 minute or sth).
877 // on the fly would be too expensive). We also cache the labels of the groups which often display dates.
909 // The "view fill" algorithm implemented in the functions below is quite smart but also quite complex.
912 // - Be flexible: allow different configurations from "unsorted flat list" to a "grouped and threaded
916 // - Be interruptible: user must be able to abort the execution and just switch to another folder in the middle
1001 for ( QHash< MessageItem *, MessageItem * >::ConstIterator it3 = itemsToDelete.constBegin(); it3 != end3; ++it3 )
1009 // mUnassignedMessageListForPass4 is empty so we must be at the end of a very special kind of Pass2
1057 for ( QHash< MessageItem *, MessageItem * >::ConstIterator it = mOrphanChildrenHash.constBegin();
1060 //Q_ASSERT( !( *it )->parent() ); <-- this assert can actually fail for items that get a temporary parent assigned (to preserve the selection).
1083 mModelForItemFunctions = q; // make sure it's true, as there remains no job with disconnected UI
1148 if ( ghi->initialExpandStatus() == Item::ExpandNeeded ) // this actually is a "non viewable expanded state"
1191 // - it has at least one children (well.. this is not a strict requirement, but it's a waste of resources to expand items that don't have children)
1195 //if ( !mView->isExpanded( idx ) ) // this is O(logN!) in Qt.... very ugly... but it should never happen here
1252 } else if ( daysAgo > 1 && daysAgo < calendar->daysInWeek( mTodayDate ) ) // Within last seven days
1255 } else if ( mAggregation->grouping() == Aggregation::GroupByDate ) { // GroupByDate seven days or more ago
1257 } else if( ( calendar->month( dDate ) == calendar->month( mTodayDate ) ) && // GroupByDateRange within this month
1260 int startOfWeekDaysAgo = ( calendar->daysInWeek( mTodayDate ) + calendar->dayOfWeek( mTodayDate ) -
1286 } else if ( calendar->year( dDate ) == calendar->year( mTodayDate ) ) { // GroupByDateRange within this year
1289 groupLabel = i18nc( "Message Aggregation Group Header: Month name and Year number", "%1 %2", calendar->monthName( dDate ),
1378 Q_ASSERT( mAggregation->threading() != Aggregation::NoThreading ); // caller must take care of this
1431 mi->setThreadingStatus( bMessageWasThreadable ? MessageItem::ParentMissing : MessageItem::NonThreadable );
1476 mi->setThreadingStatus( bMessageWasThreadable ? MessageItem::ParentMissing : MessageItem::NonThreadable );
1488 mi->setThreadingStatus( ( bMessageWasThreadable || mi->subjectIsPrefixed() ) ? MessageItem::ParentMissing : MessageItem::NonThreadable );
1496 void dump_iterator_and_list( QList< MessageItem * >::Iterator &iter, QList< MessageItem * > *list )
1502 kDebug() << "Iterator pointing to " << *iter << " subject [" << (*iter)->subject() << "] date [" << (*iter)->date() << "]" << endl;
1506 kDebug() << "List element " << *it << " subject [" << (*it)->subject() << "] date [" << (*it)->date() << "]" << endl;
1518 kDebug() << "List element " << *it << " subject [" << (*it)->subject() << "] date [" << (*it)->date() << "]" << endl;
1542 // Messages in this cache are sorted by date, and if dates are equal then they are sorted by pointer value.
1557 mThreadingCacheMessageSubjectMD5ToMessageItem.insert( mi->strippedSubjectMD5(), messagesWithTheSameStrippedSubject );
1566 QList< MessageItem * >::Iterator it = qLowerBound( messagesWithTheSameStrippedSubject->begin(), messagesWithTheSameStrippedSubject->end(), mi, MessageLessThanByDate() );
1578 QList< MessageItem * > * messagesWithTheSameStrippedSubject = mThreadingCacheMessageSubjectMD5ToMessageItem.value( mi->strippedSubjectMD5(), 0 );
1584 QList< MessageItem * >::Iterator it = qLowerBound( messagesWithTheSameStrippedSubject->begin(), messagesWithTheSameStrippedSubject->end(), mi, MessageLessThanByDate() );
1612 Q_ASSERT( mAggregation->threading() == Aggregation::PerfectReferencesAndSubject ); // caller must take care of this
1641 for ( QList< MessageItem * >::ConstIterator it = messagesWithTheSameStrippedSubject->constBegin(); it != end; ++it )
1704 template< class ItemComparator > static bool messageItemNeedsReSorting( SortOrder::SortDirection messageSortDirection,
1715 bool ModelPrivate::handleItemPropertyChanges( int propertyChangeMask, Item * parent, Item * item )
1720 // - If we're sorting messages by min/max date then at each level the messages might need resorting.
1756 mGroupHeadersThatNeedUpdate.insert( static_cast< GroupHeaderItem * >( item ), static_cast< GroupHeaderItem * >( item ) );
1770 if ( messageItemNeedsReSorting< ItemDateComparator >( mSortOrder->messageSortDirection(), parent->d_ptr, static_cast< MessageItem * >( item ) ) )
1777 if ( messageItemNeedsReSorting< ItemMaxDateComparator >( mSortOrder->messageSortDirection(), parent->d_ptr, static_cast< MessageItem * >( item ) ) )
1784 if ( messageItemNeedsReSorting< ItemActionItemStatusComparator >( mSortOrder->messageSortDirection(), parent->d_ptr, static_cast< MessageItem * >( item ) ) )
1791 if ( messageItemNeedsReSorting< ItemUnreadStatusComparator >( mSortOrder->messageSortDirection(), parent->d_ptr, static_cast< MessageItem * >( item ) ) )
1798 if ( messageItemNeedsReSorting< ItemImportantStatusComparator >( mSortOrder->messageSortDirection(), parent->d_ptr, static_cast< MessageItem * >( item ) ) )
1852 if ( messageItemNeedsReSorting< ItemDateComparator >( mSortOrder->messageSortDirection(), parent->d_ptr, static_cast< MessageItem * >( item ) ) )
1859 if ( messageItemNeedsReSorting< ItemMaxDateComparator >( mSortOrder->messageSortDirection(), parent->d_ptr, static_cast< MessageItem * >( item ) ) )
1866 if ( messageItemNeedsReSorting< ItemActionItemStatusComparator >( mSortOrder->messageSortDirection(), parent->d_ptr, static_cast< MessageItem * >( item ) ) )
1873 if ( messageItemNeedsReSorting< ItemUnreadStatusComparator >( mSortOrder->messageSortDirection(), parent->d_ptr, static_cast< MessageItem * >( item ) ) )
1880 if ( messageItemNeedsReSorting< ItemImportantStatusComparator >( mSortOrder->messageSortDirection(), parent->d_ptr, static_cast< MessageItem * >( item ) ) )
1938 mGroupHeadersThatNeedUpdate.insert( static_cast< GroupHeaderItem * >( oldParent ), static_cast< GroupHeaderItem * >( oldParent ) );
2079 Q_ASSERT( !mThreadingCacheMessageInReplyToIdMD5ToMessageItem.contains( mi->inReplyToIdMD5(), mi ) );
2182 case Aggregation::ExpandThreadsWithNewMessages: // No more new status. fall through to unread if it exists in config
2191 if ( childNeedsExpanding || !mi->status().isRead() || mi->status().isImportant() || mi->status().isToAct() )
2294 ModelPrivate::ViewItemJobResult ModelPrivate::viewItemJobStepInternalForJobPass5( ViewItemJob *job, const QTime &tStart )
2302 QHash< GroupHeaderItem *, GroupHeaderItem * >::Iterator it = mGroupHeadersThatNeedUpdate.begin();
2303 QHash< GroupHeaderItem *, GroupHeaderItem * >::Iterator end = mGroupHeadersThatNeedUpdate.end();
2335 needsReSorting = ( *it )->parent()->d_ptr->childItemNeedsReSorting< _ItemDateComparator, true >( *it ); \
2338 needsReSorting = ( *it )->parent()->d_ptr->childItemNeedsReSorting< _ItemDateComparator, false >( *it ); \
2402 ModelPrivate::ViewItemJobResult ModelPrivate::viewItemJobStepInternalForJobPass4( ViewItemJob *job, const QTime &tStart )
2451 ModelPrivate::ViewItemJobResult ModelPrivate::viewItemJobStepInternalForJobPass3( ViewItemJob *job, const QTime &tStart )
2503 // so parent not found, (threadingStatus() is either MessageItem::ParentMissing or MessageItem::NonThreadable)
2504 Q_ASSERT( ( mi->threadingStatus() == MessageItem::ParentMissing ) || ( mi->threadingStatus() == MessageItem::NonThreadable ) );
2510 Q_ASSERT( ( mi->threadingStatus() == MessageItem::ParentMissing ) || ( mi->threadingStatus() == MessageItem::NonThreadable ) );
2516 // Since we don't end here if mi has status of parent missing then mi must not have imperfect parent.
2544 ModelPrivate::ViewItemJobResult ModelPrivate::viewItemJobStepInternalForJobPass2( ViewItemJob *job, const QTime &tStart )
2549 // to attach in Pass1Fill and their children (which we find here) will make it to the small Pass3
2569 // If it has no parent or it has a temporary one (mi->parent() && mi->threadingStatus() == MessageItem::ParentMissing)
2570 // then we attempt to (re-)thread it. Otherwise we just do nothing (the job has already been done by the previous steps).
2596 // so parent not found, (threadingStatus() is either MessageItem::ParentMissing or MessageItem::NonThreadable)
2622 // Since we don't end here if mi has status of parent missing then mi must not have imperfect parent.
2654 ModelPrivate::ViewItemJobResult ModelPrivate::viewItemJobStepInternalForJobPass1Fill( ViewItemJob *job, const QTime &tStart )
2675 unsigned long msgToSelect = mPreSelectionMode == PreSelectLastSelected ? mStorageModel->preSelectedMessage() : 0;
2732 mStorageModel->fillMessageItemThreadingData( mi, curIndex, StorageModel::PerfectThreadingReferencesAndSubject );
2738 mStorageModel->fillMessageItemThreadingData( mi, curIndex, StorageModel::PerfectThreadingPlusReferences );
2741 mStorageModel->fillMessageItemThreadingData( mi, curIndex, StorageModel::PerfectThreadingOnly );
2757 QList< MessageItem * > lImperfectlyThreaded = mThreadingCacheMessageInReplyToIdMD5ToMessageItem.values( mi->messageIdMD5() );
2762 for ( QList< MessageItem * >::ConstIterator it = lImperfectlyThreaded.constBegin(); it != end; ++it )
2770 Q_ASSERT_X( false, "ModelPrivate::viewItemJobStepInternalForJobPass1Fill", "Wrong threading status" );
2876 //kDebug() << "Setting message status from " << mi->threadingStatus() << " to non threadable (1) " << mi;
2902 //kDebug() << "Setting message status from " << mi->threadingStatus() << " to non threadable (2) " << mi;
2934 ModelPrivate::ViewItemJobResult ModelPrivate::viewItemJobStepInternalForJobPass1Cleanup( ViewItemJob *job, const QTime &tStart )
2960 MessageItem * dyingMessage = dynamic_cast< MessageItem * >( invalidatedMessages->at( curIndex ) );
2996 mCurrentItemToRestoreAfterViewItemJobStep = mView->messageItemAfter( dyingMessage, MessageTypeAny, false );
3003 mCurrentItemToRestoreAfterViewItemJobStep = mView->messageItemBefore( dyingMessage, MessageTypeAny, false );
3006 Q_ASSERT( (!mCurrentItemToRestoreAfterViewItemJobStep) || mCurrentItemToRestoreAfterViewItemJobStep->isViewable() );
3029 mOrphanChildrenHash.remove( dyingMessage ); // this can turn to a no-op (dyingMessage not present in fact)
3061 Q_ASSERT( !mThreadingCacheMessageInReplyToIdMD5ToMessageItem.contains( dyingMessage->inReplyToIdMD5(), dyingMessage ) );
3082 Q_ASSERT( !mThreadingCacheMessageInReplyToIdMD5ToMessageItem.contains( childMessage->inReplyToIdMD5(), childMessage ) );
3083 mThreadingCacheMessageInReplyToIdMD5ToMessageItem.insert( childMessage->inReplyToIdMD5(), childMessage );
3185 ModelPrivate::ViewItemJobResult ModelPrivate::viewItemJobStepInternalForJobPass1Update( ViewItemJob *job, const QTime &tStart )
3208 MessageItem * message = dynamic_cast< MessageItem * >( messagesThatNeedUpdate->at( curIndex ) );
3271 Q_ASSERT( message->parent() ); // handleItemPropertyChanges() must never leave an item detached
3279 } // else there is no parent so the item isn't attached to the view: re-grouping/re-sorting not needed.
3285 // In all the other cases we (re-)apply the filter to the topmost subtree that this message is in.
3299 // above and climb up eventually hiding parents (without descending the sibling subtrees again).
3333 ModelPrivate::ViewItemJobResult ModelPrivate::viewItemJobStepInternalForJob( ViewItemJob *job, const QTime &tStart )
3608 foreach( const QList< MessageItem * > *messages, mThreadingCacheMessageSubjectMD5ToMessageItem ) {
3613 messagesWithSameSubjectAvg = messagesWithSameSubjectAvg / (float)mThreadingCacheMessageSubjectMD5ToMessageItem.size();
3718 // With a connected UI we need to avoid the view to update the scrollbars at EVERY insertion or expansion.
3719 // QTreeViewPrivate::updateScrollBars() is very expensive as it loops through ALL the items in the view every time.
3720 // We can't disable the function directly as it's hidden in the private data object of QTreeView
3909 // This is generally SLOW AS HELL... (so we avoid it if we lock the view and thus don't need it)
3929 mFillStepTimer.start( mViewItemJobStepIdleInterval ); // this is a single shot timer connected to viewItemJobStep()
4049 kDebug() << "Gonna restore current here" << mCurrentItemToRestoreAfterViewItemJobStep->subject();
4065 kDebug() << "Gonna restore selection here" << mCurrentItemToRestoreAfterViewItemJobStep->subject();
4068 selection.append( QItemSelectionRange( q->index( mCurrentItemToRestoreAfterViewItemJobStep, 0 ) ) );
4069 mView->selectionModel()->select( selection, QItemSelectionModel::Select | QItemSelectionModel::Rows );
4074 // FIXME: If it was selected before the change, then re-select it (it may happen that it's not)
4078 QRect rectAfterViewItemJobStep = mView->visualRect( q->index( mCurrentItemToRestoreAfterViewItemJobStep, 0 ) );
4082 mView->verticalScrollBar()->setValue( mView->verticalScrollBar()->value() + rectAfterViewItemJobStep.y() - rectBeforeViewItemJobStep.y() );
4093 // Either there was no current item before, or it was lost in a cleanup step and another candidate for
4127 // and the messages created... no need to care anymore: the invariant row mapper will do the job.
4172 // The second part ranges from "from" to job->endIndex() that are now shifted up by count steps.
4175 ViewItemJob * newJob = new ViewItemJob( from + count, job->endIndex() + count, job->chunkTimeout(), job->idleInterval(), job->messageCheckCount() );
4322 ViewItemJob * newJob = new ViewItemJob( from, job->endIndex() - count, job->chunkTimeout(), job->idleInterval(), job->messageCheckCount() );
4329 } // else the change includes completely the end of the job and no other part of it can be completed.
4334 // The change starts below (or exactly on the beginning of) the job. ( from <= job->currentIndex() )
4371 QList< ModelInvariantIndex * > * invalidatedIndexes = mInvariantRowMapper->modelRowsRemoved( from, count );
4387 //kDebug() << "Appending " << invalidatedIndexes->count() << " invalidated indexes to existing cleanup job" << endl;
4401 //kDebug() << "Creating new cleanup job for " << invalidatedIndexes->count() << " invalidated indexes" << endl;
4403 ViewItemJob * job = new ViewItemJob( ViewItemJob::Pass1Cleanup, invalidatedIndexes, 100, 50, 10 );
4420 void ModelPrivate::slotStorageModelDataChanged( const QModelIndex &fromIndex, const QModelIndex &toIndex )
4422 Q_ASSERT( mStorageModel ); // must exist (and be the sender of the signal connected to this slot)
4435 QList< ModelInvariantIndex * > * indexesThatNeedUpdate = mInvariantRowMapper->modelIndexRowRangeToModelInvariantIndexList( from, count );
4464 ViewItemJob * job = new ViewItemJob( ViewItemJob::Pass1Update, indexesThatNeedUpdate, 100, 50, 10 );
4560 QList< MessageItem * > Model::persistentSetCurrentMessageItemList( MessageItemSetReference ref )
void clearOrphanChildrenHash()
Definition: model.cpp:1054
bool childItemNeedsReSorting(Item *child)
Checks if the specified child item is actually in the wrong position in the child list and returns tr...
Definition: item_p.h:191
Sort the messages by date and time of the most recent message in subtree.
Definition: sortorder.h:82
QString mCachedTwoWeeksAgoLabel
The label for the "Two Weeks Ago" group item, cached, so we don't translate it multiple times...
Definition: model_p.h:327
void setPreSelectionMode(PreSelectionMode preSelect)
Sets the pre-selection mode.
Definition: model.cpp:902
Thread by "In-Reply-To" and "References" fields.
Definition: aggregation.h:87
QHash< GroupHeaderItem *, GroupHeaderItem * > mGroupHeadersThatNeedUpdate
List of group headers that either need to be re-sorted or must be removed because empty...
Definition: model_p.h:230
QMultiHash< QByteArray, MessageItem * > mThreadingCacheMessageInReplyToIdMD5ToMessageItem
Threading cache.
Definition: model_p.h:219
A class which holds information about sorting, e.g.
Definition: sortorder.h:37
Sort the messages by subject.
Definition: sortorder.h:86
bool handleItemPropertyChanges(int propertyChangeMask, Item *parent, Item *item)
Handle the specified property changes in item.
Definition: model.cpp:1715
void modelReset()
Call this function from your handlers of reset() and layoutChanged() AFTER you ve last accessed the m...
Definition: modelinvariantrowmapper.cpp:576
Item * mRootItem
Owned invisible root item, useful to implement algorithms that not need to handle the special case of...
Definition: model_p.h:267
A set of aggregation options that can be applied to the MessageList::Model in a single shot...
Definition: aggregation.h:43
Item * messageItemBefore(Item *referenceItem, MessageTypeFilter messageTypeFilter, bool loop)
Finds message item that comes "before" the reference item.
Definition: view.cpp:1252
void ignoreCurrentChanges(bool ignore)
This is called by the model to insulate us from certain QTreeView signals This is because they may be...
Definition: view.cpp:163
Must expand when this item becomes viewable.
Definition: item.h:75
This class manages sets of messageitem references.
Definition: messageitemsetmanager.h:48
bool mStorageModelContainsOutboundMessages
The cached result of StorageModel::containsOutboundMessages().
Definition: model_p.h:422
Sort groups by date/time of the group.
Definition: sortorder.h:54
void statusMessage(const QString &message)
Notify the outside when updating the status bar with a message could be useful.
QString mCachedUnknownLabel
The label for the "Unknown" group item, cached, so we don't translate it multiple times...
Definition: model_p.h:317
Model * mModelForItemFunctions
This pointer is passed to the Item functions that insert children.
Definition: model_p.h:415
ThreadLeader threadLeader() const
Returns the current thread leader determination method.
Definition: aggregation.h:221
Thread by all of the above and try to match subjects too.
Definition: aggregation.h:88
Definition: messageitem.h:50
QList< MessageItem * > mUnassignedMessageListForPass4
List of unassigned messages, used to handle threading in two passes, pointers are owned! ...
Definition: model_p.h:245
const QString & label() const
Definition: groupheaderitem.cpp:35
void setThreadingStatus(ThreadingStatus threadingStatus)
Definition: messageitem.cpp:554
Perform no threading at all.
Definition: aggregation.h:85
MessageItem * guessMessageParent(MessageItem *mi)
Attempt to find the threading parent for the specified message item.
Definition: model.cpp:1603
QList< ViewItemJob * > mViewItemJobs
Pending fill view jobs, pointers are owned.
Definition: model_p.h:255
const QString & senderOrReceiver() const
Returns the sender or the receiver, depending on the underlying StorageModel settings.
Definition: item.cpp:462
MessageItem * topmostMessage()
Definition: messageitem.cpp:578
Makes sense only with GroupByDate or GroupByDateRange.
Definition: aggregation.h:73
~Model()
Destroys the mighty model along with the tree of items it manages.
Definition: model.cpp:310
qint32 mCachedWatchedOrIgnoredStatusBits
Cached bits that we use for fast status checks.
Definition: model_p.h:347
const QString & pixmapName() const
Returns the icon's name (used in SmallIcon) set for this column.
Definition: theme.h:686
Definition: enums.h:58
virtual int initialUnreadRowCountGuess() const
Returns (a guess for) the number of unread messages: must be pessimistic (i.e.
Definition: storagemodelbase.cpp:36
void slotStorageModelLayoutChanged()
Definition: model.cpp:4412
QString mCachedFourWeeksAgoLabel
The label for the "Four Weeks Ago" group item, cached, so we don't translate it multiple times...
Definition: model_p.h:337
Group the messages by the date of the thread leader.
Definition: aggregation.h:55
Item * rootItem() const
Returns the hidden root item that all the messages are (or will be) attached to.
Definition: model.cpp:4525
void syncExpandedStateOfSubtree(Item *root)
Sync the expanded state of the subtree with the specified root.
Definition: model.cpp:1184
Thread by "In-Reply-To" field only.
Definition: aggregation.h:86
Definition: item_p.h:41
void modelJobBatchTerminated()
This is called by Model to signal the end of a lengthy job batch.
Definition: view.cpp:287
MessageItem * messageItemByStorageRow(int row) const
Returns the message item that is at the current storage row index or zero if no such storage item is ...
Definition: model.cpp:4535
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
Definition: model.cpp:590
Sort groups by receiver (makes sense only with GroupByReceiver)
Definition: sortorder.h:58
const QString & receiver() const
Returns the receiver associated to this item.
Definition: item.cpp:452
Never expand groups during a view fill algorithm.
Definition: aggregation.h:72
Use smart (thread leader) date ranges ("Today","Yesterday","Last Week"...)
Definition: aggregation.h:56
void setViewable(Model *model, bool bViewable)
Makes this item viewable, that is, notifies its existence to any listener attacched to the "rowsInser...
Definition: item.cpp:323
This class is an optimizing helper for dealing with large flat QAbstractItemModel objects...
Definition: modelinvariantrowmapper.h:93
void attachMessageToParent(Item *pParent, MessageItem *mi)
Definition: model.cpp:1987
bool isScrollingLocked() const
Returns true if the vertical scrollbar should keep to the top or bottom while inserting items...
Definition: view.cpp:182
ViewItemJobResult viewItemJobStepInternalForJobPass5(ViewItemJob *job, const QTime &tStart)
Definition: model.cpp:2294
A helper class used with MessageList::Item::childItemNeedsReSorting() and MessageList::Item::insertCh...
Definition: item_p.h:301
void removeMessageItemFromAllSets(MessageItem *mi)
Definition: messageitemsetmanager.cpp:75
const QString & subject() const
Returns the subject associated to this Item.
Definition: item.cpp:472
size_t size() const
Returns the size of this item (size of the Message, mainly)
Definition: item.cpp:412
The MessageList::View is the real display of the message list.
Definition: view.h:64
this message might belong to a thread but its parent is actually missing
Definition: messageitem.h:80
A helper class used with MessageList::Item::childItemNeedsReSorting() and MessageList::Item::insertCh...
Definition: item_p.h:338
Item * messageItemAfter(Item *referenceItem, MessageTypeFilter messageTypeFilter, bool loop)
Finds message item that comes "after" the reference item.
Definition: view.cpp:1122
int mViewItemJobStepChunkTimeout
The timeout for a single ViewItemJob step.
Definition: model_p.h:283
bool isSenderOrReceiver() const
Returns true if this column is marked as "sender/receiver" and we should update its label on-the-fly...
Definition: theme.h:699
this message found an imperfect parent to attach to (might be fixed later)
Definition: messageitem.h:79
QHash< QByteArray, MessageItem * > mThreadingCacheMessageIdMD5ToMessageItem
Threading cache.
Definition: model_p.h:213
bool recomputeMaxDate()
Recompute the maximum date from the current children list.
Definition: item.cpp:276
bool isValid() const
Returns true if this ModelInvariantIndex is valid, that is, it has been attacched to a ModelInvariant...
Definition: modelinvariantindex.cpp:42
MessageItem * mLastSelectedMessageInFolder
The id of the preselected ;essage is "translated" to a message pointer when it's fetched from the sto...
Definition: model_p.h:395
void checkIfDateChanged()
This is called by MessageList::Manager once in a while.
Definition: model.cpp:871
The thread grouping is computed from the topmost message (very similar to least recent, but might be different if timezones or machine clocks are screwed)
Definition: aggregation.h:99
void messageDetachedUpdateParentProperties(Item *oldParent, MessageItem *mi)
Definition: model.cpp:1892
StorageModel * storageModel() const
Returns the StorageModel currently set.
Definition: model.cpp:623
virtual void prepareForScan()=0
Called by Model just before this StorageModel is attacched to it.
virtual QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
Definition: model.cpp:446
void clearThreadingCacheMessageSubjectMD5ToMessageItem()
Definition: model.cpp:1048
The Column class defines a view column available inside this theme.
Definition: theme.h:564
Definition: model_p.h:33
SortDirection
The "generic" sort direction: used for groups and for messages If you add values here please look at ...
Definition: sortorder.h:67
void setInitialExpandStatus(InitialExpandStatus initialExpandStatus)
Set the initial expand status we have to honor when attacching to the viewable root.
Definition: item.cpp:308
A helper class used with MessageList::Item::childItemNeedsReSorting() and MessageList::Item::insertCh...
Definition: item_p.h:259
A helper class used with MessageList::Item::childItemNeedsReSorting() and MessageList::Item::insertCh...
Definition: item_p.h:398
QString mCachedYesterdayLabel
The label for the "Yesterday" group item, cached, so we don't translate it multiple times...
Definition: model_p.h:312
unsigned long preSelectedMessage() const
Returns the unique id of the last selected message for this StorageModel.
Definition: storagemodelbase.cpp:41
Sort the messages by receiver.
Definition: sortorder.h:85
int mViewItemJobStepIdleInterval
The idle time between two ViewItemJob steps.
Definition: model_p.h:288
unsigned long uniqueId() const
Definition: messageitem.cpp:560
Don't sort the groups at all, add them as they come in.
Definition: sortorder.h:53
int appendChildItem(Model *model, Item *child)
Appends an Item to this item's child list.
Definition: item.cpp:521
QList< MessageItem * > mUnassignedMessageListForPass3
List of unassigned messages, used to handle threading in two passes, pointers are owned! ...
Definition: model_p.h:240
QHash< QString, GroupHeaderItem * > mGroupHeaderItemHash
Group Key (usually the label) -> GroupHeaderItem, used to quickly find groups, pointers are shallow c...
Definition: model_p.h:207
this message does not look as being threadable
Definition: messageitem.h:81
void modelFinishedLoading()
This is called by Model to signal that the initial loading stage of a newly attached StorageModel is ...
Definition: view.cpp:1662
Expand all threads (this might be very slow)
Definition: aggregation.h:114
Akonadi::Item akonadiItem() const
Definition: messageitem.cpp:566
void ensureDisplayedWithParentsExpanded(Item *it)
Makes sure that the specified is currently viewable by the user.
Definition: view.cpp:1844
Expand threads with unread messages (this includes new)
Definition: aggregation.h:113
QByteArray strippedSubjectMD5() const
Definition: messageitem.cpp:524
virtual QMimeData * mimeData(const QModelIndexList &indexes) const
Called when user initiates a drag from the messagelist.
Definition: model.cpp:4510
MessageSorting messageSorting() const
Returns the current message sorting option.
Definition: sortorder.h:126
A helper class used with MessageList::Item::childItemNeedsReSorting() and MessageList::Item::insertCh...
Definition: item_p.h:419
Group by receiver, always.
Definition: aggregation.h:59
void modelHasBeenReset()
This is called by the model from inside setFolder().
Definition: view.cpp:293
SortDirection messageSortDirection() const
Returns the current message SortDirection.
Definition: sortorder.h:138
ViewItemJobResult viewItemJobStepInternalForJobPass1Update(ViewItemJob *job, const QTime &tStart)
Definition: model.cpp:3185
bool useReceiver() const
Returns whether sender or receiver is supposed to be displayed.
Definition: item.cpp:467
A helper class used with MessageList::Item::childItemNeedsReSorting() and MessageList::Item::insertCh...
Definition: item_p.h:378
QByteArray messageIdMD5() const
Definition: messageitem.cpp:476
QHash< MessageItem *, MessageItem * > mOrphanChildrenHash
Hash of orphan children used in Pass1Cleanup.
Definition: model_p.h:250
MessageItemSetManager * mPersistentSetManager
The "persistent message item sets" are (guess what?) sets of messages that can be referenced globally...
Definition: model_p.h:409
A helper class used with MessageList::Item::childItemNeedsReSorting() and MessageList::Item::insertCh...
Definition: item_p.h:277
QHash< QByteArray, QList< MessageItem * > * > mThreadingCacheMessageSubjectMD5ToMessageItem
Threading cache.
Definition: model_p.h:225
All groups are expanded as they are inserted.
Definition: aggregation.h:74
PreSelectionMode mPreSelectionMode
Pre-selection is the action of automatically selecting a message just after the folder has finished l...
Definition: model_p.h:381
void modelRowsInserted(int modelIndexRowPosition, int count)
Call this function when rows are inserted to the underlying model BEFORE scanning the model for the n...
Definition: modelinvariantrowmapper.cpp:393
bool hasAncestor(const Item *it) const
Return true if Item pointed by it is an ancestor of this item (that is, if it is its parent...
Definition: item.cpp:318
this message found a perfect parent to attach to
Definition: messageitem.h:78
virtual void updateGeometries()
Reimplemented in order to disable update of the geometries while a job step is running (as it takes a...
Definition: view.cpp:219
PreSelectionMode
Pre-selection is the action of automatically selecting a message just after the folder has finished l...
Definition: enums.h:44
void setCurrentMessageItem(MessageItem *it, bool center=false)
Sets the current message item.
Definition: view.cpp:883
void attachGroup(GroupHeaderItem *ghi)
Definition: model.cpp:1087
static bool messageItemNeedsReSorting(SortOrder::SortDirection messageSortDirection, ItemPrivate *parent, MessageItem *messageItem)
Definition: model.cpp:1704
ViewItemJobResult viewItemJobStepInternalForJobPass1Fill(ViewItemJob *job, const QTime &tStart)
Definition: model.cpp:2654
void slotStorageModelRowsInserted(const QModelIndex &parent, int from, int to)
Definition: model.cpp:4105
void slotSelectionChanged(const QItemSelection ¤t, const QItemSelection &)
Handles selection item management.
Definition: view.cpp:1921
void killAllChildItems()
Kills all the child items without emitting any signal, recursively.
Definition: item.cpp:380
Item * childItem(int idx) const
Returns the child item at position idx or 0 if idx is out of the allowable range. ...
Definition: item.cpp:75
void slotStorageModelHeaderDataChanged(Qt::Orientation orientation, int first, int last)
Definition: model.cpp:4474
ViewItemJobResult viewItemJobStepInternalForJobPass1Cleanup(ViewItemJob *job, const QTime &tStart)
Definition: model.cpp:2934
time_t mViewItemJobStepStartTime
The time at the current ViewItemJob step started.
Definition: model_p.h:278
void slotStorageModelRowsRemoved(const QModelIndex &parent, int from, int to)
Definition: model.cpp:4237
InitialExpandStatus initialExpandStatus() const
The initial expand status we have to honor when attacching to the viewable root.
Definition: item.cpp:303
ViewItemJobResult viewItemJobStepInternalForJobPass2(ViewItemJob *job, const QTime &tStart)
Definition: model.cpp:2544
void createModelInvariantIndex(int modelIndexRow, ModelInvariantIndex *invariantToFill)
Binds a ModelInvariantIndex structure to the specified CURRENT modelIndexRow.
Definition: modelinvariantrowmapper.cpp:344
bool applyFilterToSubtree(Item *item, const QModelIndex &parentIndex)
Recursively applies the current filter to the tree originating at the specified item.
Definition: model.cpp:377
messageIdMD5, inReplyToMD5, referencesIdMD5
Definition: storagemodelbase.h:98
virtual void setMessageItemStatus(MessageItem *mi, int row, const Akonadi::MessageStatus &status)=0
This method should use the inner model implementation to associate the new status to the specified me...
void slotStorageModelDataChanged(const QModelIndex &fromIndex, const QModelIndex &toIndex)
Definition: model.cpp:4420
Do larger chunks of work, zero intervals between chunks.
Definition: aggregation.h:127
void deletePersistentSet(MessageItemSetReference ref)
Deletes the persistent set pointed by the specified reference.
Definition: model.cpp:4568
ViewItemJobResult viewItemJobStepInternalForJobPass4(ViewItemJob *job, const QTime &tStart)
Definition: model.cpp:2402
#define INSERT_MESSAGE_WITH_COMPARATOR(_ItemComparator)
Sort the messages by sender.
Definition: sortorder.h:84
Model(View *pParent)
Creates the mighty Model attached to the specified View.
Definition: model.cpp:265
This item is just Item and it's the only InvisibleRoot per Model.
Definition: item.h:65
QList< MessageItem * > mUnassignedMessageListForPass2
List of unassigned messages, used to handle threading in two passes, pointers are owned! ...
Definition: model_p.h:235
void modelAboutToEmitLayoutChanged()
Definition: view.cpp:696
int mViewItemJobStepMessageCheckCount
The number of messages we process at once in a ViewItemJob step without checking the timeouts above...
Definition: model_p.h:294
GroupExpandPolicy groupExpandPolicy() const
Returns the current GroupExpandPolicy.
Definition: aggregation.h:181
void setFilter(const Filter *filter)
Sets the Filter to be applied on messages.
Definition: model.cpp:351
QTimer mFillStepTimer
The timer involved in breaking the "fill" operation in steps.
Definition: model_p.h:202
A single item of the MessageList tree managed by MessageList::Model.
Definition: item.h:52
MessageItemSetReference createPersistentSet(const QList< MessageItem * > &items)
Creates a persistent set for the specified MessageItems and returns its reference.
Definition: model.cpp:4547
A helper class used with MessageList::Item::childItemNeedsReSorting() and MessageList::Item::insertCh...
Definition: item_p.h:318
A helper class used with MessageList::Item::childItemNeedsReSorting() and MessageList::Item::insertCh...
Definition: item_p.h:443
void saveExpandedStateOfSubtree(Item *root)
Save the expanded state of the subtree with the specified root.
Definition: model.cpp:1162
Expand threads with "hot" messages (this includes new, unread, important, todo)
Definition: aggregation.h:115
QList< MessageItem * > persistentSetCurrentMessageItemList(MessageItemSetReference ref)
Returns the list of MessageItems that are still existing in the set pointed by the specified referenc...
Definition: model.cpp:4560
Sort groups by sender (makes sense only with GroupBySender)
Definition: sortorder.h:57
ThreadingStatus threadingStatus() const
Definition: messageitem.cpp:548
A helper class used with MessageList::Item::childItemNeedsReSorting() and MessageList::Item::insertCh...
Definition: item_p.h:358
Never expand any thread, this is fast.
Definition: aggregation.h:111
The QAbstractItemModel based interface that you need to provide for your storage to work with Message...
Definition: storagemodelbase.h:45
void modelEmittedLayoutChanged()
Definition: view.cpp:702
Don't sort the messages at all.
Definition: sortorder.h:80
QList< ModelInvariantIndex * > * modelIndexRowRangeToModelInvariantIndexList(int startIndexRow, int count)
This basically applies modelIndexRowToModelInvariantIndex() to a range of elements.
Definition: modelinvariantrowmapper.cpp:363
int mRecursionCounterForReset
counter to avoid infinite recursions in the setStorageModel() function
Definition: model_p.h:172
virtual bool initializeMessageItem(MessageItem *it, int row, bool bUseReceiver) const =0
This method should use the inner model implementation to fill in the base data for the specified Mess...
The thread grouping is computed from the most recent message.
Definition: aggregation.h:100
Do small chunks of work, small intervals between chunks to allow for UI event processing.
Definition: aggregation.h:126
Sort the messages by sender or receiver.
Definition: sortorder.h:83
bool subjectIsPrefixed() const
Definition: messageitem.cpp:518
QString accessibleText(const MessageList::Core::Theme *theme, int columnIndex)
Definition: messageitem.cpp:614
Definition: enums.h:46
void addMessageToSubjectBasedThreadingCache(MessageItem *mi)
Definition: model.cpp:1540
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const
Definition: model.cpp:437
time_t maxDate() const
Returns the maximum date in the subtree originating from this item.
Definition: item.cpp:432
bool match(const MessageItem *item) const
Returns true if the specified parameters match this filter and false otherwise.
Definition: filter.cpp:61
ViewItemJobResult viewItemJobStepInternalForJob(ViewItemJob *job, const QTime &tStart)
Definition: model.cpp:3333
void setStorageModel(StorageModel *storageModel, PreSelectionMode preSelectionMode=PreSelectLastSelected)
Sets the storage model from that the messages to be displayed should be fetched.
Definition: model.cpp:672
Sort the messages By "Important" flags of status.
Definition: sortorder.h:90
Column * column(int idx) const
Returns a pointer to the column at the specified index or 0 if there is no such column.
Definition: theme.h:946
QString mCachedLastWeekLabel
The label for the "Last Week" group item, cached, so we don't translate it multiple times...
Definition: model_p.h:322
All of the above plus subject stuff.
Definition: storagemodelbase.h:99
MessageItem * findMessageParent(MessageItem *mi)
Attempt to find the threading parent for the specified message item.
Definition: model.cpp:1376
virtual void setRowHidden(int row, const QModelIndex &parent, bool hide)
Called to hide or show the specified row from the view.
Definition: view.cpp:2729
This class is responsable of matching messages that should be displayed in the View.
Definition: filter.h:51
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const
Definition: model.cpp:494
DEPRECATED. New message status no longer exists.
Definition: aggregation.h:112
FillViewStrategy fillViewStrategy() const
Returns the current fill view strategy.
Definition: aggregation.h:266
virtual void updateMessageItemData(MessageItem *mi, int row) const =0
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.
virtual QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Definition: model.cpp:545
void setMaxDate(time_t date)
Sets the maximum date in the subtree originating from this item.
Definition: item.cpp:437
ModelInvariantRowMapper * mInvariantRowMapper
Our mighty ModelInvariantRowMapper: used to workaround an issue related to the Model/View architectur...
Definition: model_p.h:302
virtual Qt::ItemFlags flags(const QModelIndex &index) const
Definition: model.cpp:4482
QString mCachedThreeWeeksAgoLabel
The label for the "Three Weeks Ago" group item, cached, so we don't translate it multiple times...
Definition: model_p.h:332
void removeMessageFromSubjectBasedThreadingCache(MessageItem *mi)
Definition: model.cpp:1570
Item * topmostNonRoot()
Returns the topmost parent item that is not a Root item (that is, is a Message or GroupHeader)...
Definition: item.cpp:192
#define CHECK_IF_GROUP_NEEDS_RESORTING(_ItemDateComparator)
Sort groups by sender or receiver (makes sense only with GroupBySenderOrReceiver) ...
Definition: sortorder.h:56
StorageModel * mStorageModel
The currently set storage model: shallow pointer.
Definition: model_p.h:177
Sort the messages by the "Unread" flags of status.
Definition: sortorder.h:89
virtual void fillMessageItemThreadingData(MessageItem *mi, int row, ThreadingDataSubset subset) const =0
This method should use the inner model implementation to fill in the specified subset of threading da...
int modelInvariantIndexToModelIndexRow(ModelInvariantIndex *invariant)
Maps a ModelInvariantIndex to the CURRENT associated row index in the model.
Definition: modelinvariantrowmapper.cpp:252
Sort the messages by size.
Definition: sortorder.h:87
ViewItemJobResult viewItemJobStepInternal()
Definition: model.cpp:3666
void attachMessageToGroupHeader(MessageItem *mi)
Definition: model.cpp:1214
Sort the messages by date and time.
Definition: sortorder.h:81
const Akonadi::MessageStatus & status() const
Returns the status associated to this Item.
Definition: item.cpp:402
void modelJobBatchStarted()
This is called by Model to signal a start of a lengthy job batch.
Definition: view.cpp:281
The Theme class defines the visual appearance of the MessageList.
Definition: theme.h:65
void setAggregation(const Aggregation *aggregation)
Sets the Aggregation mode.
Definition: model.cpp:329
ViewItemJobResult viewItemJobStepInternalForJobPass3(ViewItemJob *job, const QTime &tStart)
Definition: model.cpp:2451
void takeChildItem(Model *model, Item *child)
Removes a child from this item's child list without deleting it.
Definition: item.cpp:559
QString mCachedFiveWeeksAgoLabel
The label for the "Five Weeks Ago" group item, cached, so we don't translate it multiple times...
Definition: model_p.h:342
Do one large chunk, no interactivity at all.
Definition: aggregation.h:128
Item * parent() const
Returns the parent Item in the tree, or 0 if this item isn't attached to the tree.
Definition: item.cpp:392
Group by sender (incoming) or receiver (outgoing) field.
Definition: aggregation.h:57
int setCount() const
Definition: messageitemsetmanager.cpp:46
void clearUnassignedMessageLists()
Definition: model.cpp:919
ThreadExpandPolicy threadExpandPolicy() const
Returns the current thread expand policy.
Definition: aggregation.h:244
Item * mCurrentItemToRestoreAfterViewItemJobStep
We need to save the current item before each job step.
Definition: model_p.h:361
An invariant index that can be ALWAYS used to reference an item inside a QAbstractItemModel.
Definition: modelinvariantindex.h:44
bool selectFirstMessageItem(MessageTypeFilter messageTypeFilter, bool centerItem)
Selects the first message item in the view that matches messageTypeFilter.
Definition: view.cpp:1610
const Aggregation * mAggregation
The currently set aggregation mode: shallow pointer set by Widget.
Definition: model_p.h:182
Sort the messages by the "Action Item" flag of status.
Definition: sortorder.h:88
#define INSERT_GROUP_WITH_COMPARATOR(_ItemComparator)
long int MessageItemSetReference
Definition: messageitemsetmanager.h:33
QByteArray referencesIdMD5() const
Definition: messageitem.cpp:500
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:482
Sort groups by date/time of the most recent message.
Definition: sortorder.h:55
QByteArray inReplyToIdMD5() const
Definition: messageitem.cpp:488
bool isLoading() const
Returns true if the view is currently loading, that is it's in the first (possibly lenghty) job batch...
Definition: model.cpp:4530
void ignoreUpdateGeometries(bool ignore)
Used to enable/disable the ignoring of updateGeometries() calls.
Definition: view.cpp:177
Only the data for messageIdMD5 and inReplyToMD5 is needed.
Definition: storagemodelbase.h:97
int indexOfChildItem(Item *item) const
Returns the actual index of the child Item item or -1 if item is not a child of this Item...
Definition: item.cpp:173
virtual bool containsOutboundMessages() const =0
Returns true if this StorageModel (folder) contains outbound messages and false otherwise.
QString mCachedTodayLabel
The label for the "Today" group item, cached, so we don't translate it multiple times.
Definition: model_p.h:307
const QList< Column * > & columns() const
Returns the list of columns available in this theme.
Definition: theme.h:940
QList< ModelInvariantIndex * > * modelRowsRemoved(int modelIndexRowPosition, int count)
Call this function when rows are removed from the underlying model AFTER accessing the removed rows f...
Definition: modelinvariantrowmapper.cpp:459
void setStatus(const Akonadi::MessageStatus &status)
Sets the status associated to this Item.
Definition: item.cpp:407
void propagateItemPropertiesToParent(Item *item)
This one checks if the parent of item requires an update due to the properties of item (that might ha...
Definition: model.cpp:1942
virtual QModelIndex parent(const QModelIndex &index) const
Definition: model.cpp:574
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:55:32 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:55:32 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.