MessageList::Core::Item

Search for usage in LXR

#include <item.h>

Inheritance diagram for MessageList::Core::Item:

Classes

class  ChildItemStats
 

Public Types

enum  InitialExpandStatus { ExpandNeeded , NoExpandNeeded , ExpandExecuted }
 
enum  Type { GroupHeader , Message , InvisibleRoot }
 

Public Member Functions

virtual ~Item ()
 
int appendChildItem (Model *model, Item *child)
 
ItemchildItem (int idx) const
 
int childItemCount () const
 
QList< Item * > * childItems () const
 
void childItemStats (ChildItemStats &stats) const
 
time_t date () const
 
ItemdeepestItem ()
 
QString displayReceiver () const
 
QString displaySender () const
 
QString displaySenderOrReceiver () const
 
void dump (const QString &prefix)
 
ItemfirstChildItem () const
 
const QStringfolder () const
 
QString formattedDate () const
 
QString formattedMaxDate () const
 
QString formattedSize () const
 
bool hasAncestor (const Item *it) const
 
bool hasChildren () const
 
int indexOfChildItem (Item *item) const
 
InitialExpandStatus initialExpandStatus () const
 
void initialSetup (time_t date, size_t size, const QString &sender, const QString &receiver, bool useReceiver)
 
bool isViewable () const
 
ItemitemAbove ()
 
ItemitemAboveChild (Item *child)
 
ItemitemBelow ()
 
ItemitemBelowChild (Item *child)
 
qint64 itemId () const
 
void killAllChildItems ()
 
time_t maxDate () const
 
Itemparent () const
 
qint64 parentCollectionId () const
 
void rawAppendChildItem (Item *child)
 
const QStringreceiver () const
 
bool recomputeMaxDate ()
 
const QStringsender () const
 
const QStringsenderOrReceiver () const
 
void setDate (time_t date)
 
void setFolder (const QString &folder)
 
void setIndexGuess (int index)
 
void setInitialExpandStatus (InitialExpandStatus initialExpandStatus)
 
void setItemId (qint64 id)
 
void setMaxDate (time_t date)
 
void setParent (Item *pParent)
 
void setParentCollectionId (qint64 id)
 
void setReceiver (const QString &receiver)
 
void setSender (const QString &sender)
 
void setSize (size_t size)
 
void setStatus (Akonadi::MessageStatus status)
 
void setSubject (const QString &subject)
 
void setSubjectAndStatus (const QString &subject, Akonadi::MessageStatus status)
 
void setViewable (Model *model, bool bViewable)
 
size_t size () const
 
const Akonadi::MessageStatusstatus () const
 
QString statusDescription () const
 
const QStringsubject () const
 
void takeChildItem (Model *model, Item *child)
 
ItemtopmostNonRoot ()
 
Type type () const
 
bool useReceiver () const
 

Protected Member Functions

 Item (Type type)
 
 Item (Type type, ItemPrivate *dd)
 

Protected Attributes

ItemPrivate *const d_ptr
 

Detailed Description

A single item of the MessageList tree managed by MessageList::Model.

This class stores basic information needed in all the subclasses which at the moment of writing are MessageItem and GroupHeaderItem.

Definition at line 35 of file item.h.

Member Enumeration Documentation

◆ InitialExpandStatus

Specifies the initial expand status for the item that should be applied when it's attached to the viewable tree.

Needed as a workaround for QTreeView limitations in handling item expansion.

Enumerator
ExpandNeeded 

Must expand when this item becomes viewable.

NoExpandNeeded 

No expand needed at all.

ExpandExecuted 

Item already expanded.

Definition at line 55 of file item.h.

◆ Type

The type of the Item.

Enumerator
GroupHeader 

This item is a GroupHeaderItem.

Message 

This item is a MessageItem.

InvisibleRoot 

This item is just Item and it's the only InvisibleRoot per Model.

Definition at line 44 of file item.h.

Constructor & Destructor Documentation

◆ Item()

Item::Item ( Type type)
protected

Creates an Item.

Only derived classes and MessageList::Model should access this.

Definition at line 20 of file item.cpp.

◆ ~Item()

Item::~Item ( )
virtual

Destroys the Item.

Should be protected just like the constructor but the QList<> helpers need to access it, so it's public actually.

Definition at line 32 of file item.cpp.

Member Function Documentation

◆ appendChildItem()

int Item::appendChildItem ( Model * model,
Item * child )

Appends an Item to this item's child list.

The Model is used for beginInsertRows()/endInsertRows() calls.

Definition at line 597 of file item.cpp.

◆ childItem()

Item * Item::childItem ( int idx) const
nodiscard

Returns the child item at position idx or 0 if idx is out of the allowable range.

Definition at line 63 of file item.cpp.

◆ childItemCount()

int Item::childItemCount ( ) const
nodiscard

Returns the number of children of this Item.

Definition at line 157 of file item.cpp.

◆ childItems()

QList< Item * > * Item::childItems ( ) const
nodiscard

Return the list of child items.

May be null.

Definition at line 58 of file item.cpp.

◆ childItemStats()

void Item::childItemStats ( ChildItemStats & stats) const

Gathers statistics about child items.

For performance purposes assumes that this item has children. You MUST check it before calling it.

Definition at line 43 of file item.cpp.

◆ date()

time_t Item::date ( ) const

Returns the date of this item.

Definition at line 466 of file item.cpp.

◆ deepestItem()

Item * Item::deepestItem ( )
nodiscard

Returns the deepest item in the subtree originating at this item.

Definition at line 117 of file item.cpp.

◆ displayReceiver()

QString Item::displayReceiver ( ) const
nodiscard

Display receiver.

Definition at line 511 of file item.cpp.

◆ displaySender()

QString Item::displaySender ( ) const
nodiscard

Display sender.

Definition at line 496 of file item.cpp.

◆ displaySenderOrReceiver()

QString Item::displaySenderOrReceiver ( ) const
nodiscard

Display sender or receiver.

Definition at line 521 of file item.cpp.

◆ dump()

void Item::dump ( const QString & prefix)

Debug helper.

Dumps the structure of this subtree.

Definition at line 620 of file item.cpp.

◆ firstChildItem()

Item * Item::firstChildItem ( ) const
nodiscard

Returns the first child item, if any.

Definition at line 77 of file item.cpp.

◆ folder()

const QString & Item::folder ( ) const

Returns the folder associated to this Item.

Definition at line 541 of file item.cpp.

◆ formattedDate()

QString Item::formattedDate ( ) const
nodiscard

A string with a text rappresentation of date() obtained via Manager.

This is computed on-the-fly and not cached.

Definition at line 305 of file item.cpp.

◆ formattedMaxDate()

QString Item::formattedMaxDate ( ) const
nodiscard

A string with a text rappresentation of maxDate() obtained via Manager.

This is computed on-the-fly and not cached.

Definition at line 314 of file item.cpp.

◆ formattedSize()

QString Item::formattedSize ( ) const
nodiscard

A string with a text rappresentation of size().

This is computed on-the-fly and not cached.

Definition at line 299 of file item.cpp.

◆ hasAncestor()

bool Item::hasAncestor ( const Item * it) const
nodiscard

Return true if Item pointed by it is an ancestor of this item (that is, if it is its parent, parent of its parent, parent of its parent of its parent etc...

Definition at line 362 of file item.cpp.

◆ hasChildren()

bool Item::hasChildren ( ) const
nodiscard

Convenience function that returns true if this item has children.

Definition at line 162 of file item.cpp.

◆ indexOfChildItem()

int Item::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 at line 167 of file item.cpp.

◆ initialExpandStatus()

Item::InitialExpandStatus Item::initialExpandStatus ( ) const
nodiscard

The initial expand status we have to honor when attaching to the viewable root.

Definition at line 347 of file item.cpp.

◆ initialSetup()

void Item::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.

It sets up several items at once (so even if not inlined it's still a single call) and it skips some calls that can be avoided at constructor time.

Definition at line 551 of file item.cpp.

◆ isViewable()

bool Item::isViewable ( ) const
nodiscard

Is this item attached to the viewable root ?

Definition at line 357 of file item.cpp.

◆ itemAbove()

Item * Item::itemAbove ( )
nodiscard

Returns the item that is visually above this item in the tree.

Note that the returned item may belong to a completely different subtree.

Definition at line 143 of file item.cpp.

◆ itemAboveChild()

Item * Item::itemAboveChild ( Item * child)
nodiscard

Returns the item that is visually above the specified child if this item.

Note that the returned item may belong to a completely different subtree.

Definition at line 128 of file item.cpp.

◆ itemBelow()

Item * Item::itemBelow ( )
nodiscard

Returns the item that is visually below this item in the tree.

Note that the returned item may belong to a completely different subtree.

Definition at line 102 of file item.cpp.

◆ itemBelowChild()

Item * Item::itemBelowChild ( Item * child)
nodiscard

Returns the item that is visually below the specified child if this item.

Note that the returned item may belong to a completely different subtree.

Definition at line 82 of file item.cpp.

◆ itemId()

qint64 Item::itemId ( ) const
nodiscard

Definition at line 566 of file item.cpp.

◆ killAllChildItems()

void Item::killAllChildItems ( )

Kills all the child items without emitting any signal, recursively.

It should be used only when MessageList::Model is reset() afterwards.

Definition at line 422 of file item.cpp.

◆ maxDate()

time_t Item::maxDate ( ) const

Returns the maximum date in the subtree originating from this item.

This is kept up-to-date by MessageList::Model.

Definition at line 476 of file item.cpp.

◆ parent()

Item * Item::parent ( ) const
nodiscard

Returns the parent Item in the tree, or 0 if this item isn't attached to the tree.

Please note that even if this item has a non-zero parent, it can be still non viewable. That is: the topmost parent of this item may be not attached to the viewable root.

Definition at line 436 of file item.cpp.

◆ parentCollectionId()

qint64 Item::parentCollectionId ( ) const
nodiscard

Definition at line 576 of file item.cpp.

◆ rawAppendChildItem()

void Item::rawAppendChildItem ( Item * child)

Appends a child item without inserting it via the model.

This is useful in ThemeEditor which doesn't use a custom model for the items. You shouldn't need to use this function...

Definition at line 589 of file item.cpp.

◆ receiver()

const QString & Item::receiver ( ) const

Returns the receiver associated to this item.

Definition at line 501 of file item.cpp.

◆ recomputeMaxDate()

bool Item::recomputeMaxDate ( )

Recompute the maximum date from the current children list.

Return true if the current max date changed and false otherwise.

Definition at line 323 of file item.cpp.

◆ sender()

const QString & Item::sender ( ) const
nodiscard

Returns the sender associated to this item.

Definition at line 486 of file item.cpp.

◆ senderOrReceiver()

const QString & Item::senderOrReceiver ( ) const

Returns the sender or the receiver, depending on the underlying StorageModel settings.

Definition at line 516 of file item.cpp.

◆ setDate()

void Item::setDate ( time_t date)

Sets the date of this item.

Definition at line 471 of file item.cpp.

◆ setFolder()

void Item::setFolder ( const QString & folder)

Sets the folder associated to this Item.

Definition at line 546 of file item.cpp.

◆ setIndexGuess()

void Item::setIndexGuess ( int index)

Sets the cached guess for the index of this item in the parent's child list.

This is used to speed up the index lookup with the following algorithm: Ask the parent if this item is at the position specified by index guess (this costs ~O(1)). If the position matches we have finished, if it doesn't then perform a linear search via indexOfChildItem() (which costs ~O(n)).

Definition at line 219 of file item.cpp.

◆ setInitialExpandStatus()

void Item::setInitialExpandStatus ( InitialExpandStatus initialExpandStatus)

Set the initial expand status we have to honor when attaching to the viewable root.

Definition at line 352 of file item.cpp.

◆ setItemId()

void Item::setItemId ( qint64 id)

Definition at line 561 of file item.cpp.

◆ setMaxDate()

void Item::setMaxDate ( time_t date)

Sets the maximum date in the subtree originating from this item.

Definition at line 481 of file item.cpp.

◆ setParent()

void Item::setParent ( Item * pParent)

Sets the parent for this item.

You should also take care of inserting this item in the parent's child list.

Definition at line 441 of file item.cpp.

◆ setParentCollectionId()

void Item::setParentCollectionId ( qint64 id)

Definition at line 571 of file item.cpp.

◆ setReceiver()

void Item::setReceiver ( const QString & receiver)

Sets the sender associated to this item.

Definition at line 506 of file item.cpp.

◆ setSender()

void Item::setSender ( const QString & sender)

Sets the sender associated to this item.

Definition at line 491 of file item.cpp.

◆ setSize()

void Item::setSize ( size_t size)

Sets the size of this item (size of the Message, mainly)

Definition at line 461 of file item.cpp.

◆ setStatus()

void Item::setStatus ( Akonadi::MessageStatus status)

Sets the status associated to this Item.

Definition at line 451 of file item.cpp.

◆ setSubject()

void Item::setSubject ( const QString & subject)

Sets the subject associated to this Item.

Definition at line 536 of file item.cpp.

◆ setSubjectAndStatus()

void Item::setSubjectAndStatus ( const QString & subject,
Akonadi::MessageStatus status )

This is meant to be called right after the constructor for MessageItem objects.

It sets up several items at once (so even if not inlined it's still a single call).

Definition at line 581 of file item.cpp.

◆ setViewable()

void Item::setViewable ( Model * model,
bool bViewable )

Makes this item viewable, that is, notifies its existence to any listener attached to the "rowsInserted()" signal, most notably QTreeView.

This will also make all the children viewable.

Definition at line 367 of file item.cpp.

◆ size()

size_t Item::size ( ) const

Returns the size of this item (size of the Message, mainly)

Definition at line 456 of file item.cpp.

◆ status()

const Akonadi::MessageStatus & Item::status ( ) const

Returns the status associated to this Item.

Definition at line 446 of file item.cpp.

◆ statusDescription()

QString Item::statusDescription ( ) const
nodiscard

Returns a string describing the status e.g: "Read, Forwarded, Important".

Definition at line 247 of file item.cpp.

◆ subject()

const QString & Item::subject ( ) const

Returns the subject associated to this Item.

Definition at line 531 of file item.cpp.

◆ takeChildItem()

void Item::takeChildItem ( Model * model,
Item * child )

Removes a child from this item's child list without deleting it.

The Model is used for beginRemoveRows()/endRemoveRows() calls.

Definition at line 637 of file item.cpp.

◆ topmostNonRoot()

Item * Item::topmostNonRoot ( )
nodiscard

Returns the topmost parent item that is not a Root item (that is, is a Message or GroupHeader).

Definition at line 224 of file item.cpp.

◆ type()

Item::Type Item::type ( ) const
nodiscard

Returns the type of this item.

The Type can be set only in the constructor.

Definition at line 342 of file item.cpp.

◆ useReceiver()

bool Item::useReceiver ( ) const

Returns whether sender or receiver is supposed to be displayed.

Definition at line 526 of file item.cpp.

Member Data Documentation

◆ d_ptr

ItemPrivate* const MessageList::Core::Item::d_ptr
protected

Definition at line 406 of file item.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jul 26 2024 11:54:19 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.