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 21 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 33 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 598 of file item.cpp.

◆ childItem()

Item * Item::childItem ( int idx) const

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

Definition at line 64 of file item.cpp.

◆ childItemCount()

int Item::childItemCount ( ) const

Returns the number of children of this Item.

Definition at line 158 of file item.cpp.

◆ childItems()

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

Return the list of child items.

May be null.

Definition at line 59 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 44 of file item.cpp.

◆ date()

time_t Item::date ( ) const

Returns the date of this item.

Definition at line 467 of file item.cpp.

◆ deepestItem()

Item * Item::deepestItem ( )

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

Definition at line 118 of file item.cpp.

◆ displayReceiver()

QString Item::displayReceiver ( ) const

Display receiver.

Definition at line 512 of file item.cpp.

◆ displaySender()

QString Item::displaySender ( ) const

Display sender.

Definition at line 497 of file item.cpp.

◆ displaySenderOrReceiver()

QString Item::displaySenderOrReceiver ( ) const

Display sender or receiver.

Definition at line 522 of file item.cpp.

◆ dump()

void Item::dump ( const QString & prefix)

Debug helper.

Dumps the structure of this subtree.

Definition at line 621 of file item.cpp.

◆ firstChildItem()

Item * Item::firstChildItem ( ) const

Returns the first child item, if any.

Definition at line 78 of file item.cpp.

◆ folder()

const QString & Item::folder ( ) const

Returns the folder associated to this Item.

Definition at line 542 of file item.cpp.

◆ formattedDate()

QString Item::formattedDate ( ) const

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

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

Definition at line 306 of file item.cpp.

◆ formattedMaxDate()

QString Item::formattedMaxDate ( ) const

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

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

Definition at line 315 of file item.cpp.

◆ formattedSize()

QString Item::formattedSize ( ) const

A string with a text rappresentation of size().

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

Definition at line 300 of file item.cpp.

◆ hasAncestor()

bool Item::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, parent of its parent, parent of its parent of its parent etc...

Definition at line 363 of file item.cpp.

◆ hasChildren()

bool Item::hasChildren ( ) const

Convenience function that returns true if this item has children.

Definition at line 163 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 168 of file item.cpp.

◆ initialExpandStatus()

Item::InitialExpandStatus Item::initialExpandStatus ( ) const

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

Definition at line 348 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 552 of file item.cpp.

◆ isViewable()

bool Item::isViewable ( ) const

Is this item attached to the viewable root ?

Definition at line 358 of file item.cpp.

◆ itemAbove()

Item * Item::itemAbove ( )

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 144 of file item.cpp.

◆ itemAboveChild()

Item * Item::itemAboveChild ( Item * child)

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 129 of file item.cpp.

◆ itemBelow()

Item * Item::itemBelow ( )

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 103 of file item.cpp.

◆ itemBelowChild()

Item * Item::itemBelowChild ( Item * child)

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 83 of file item.cpp.

◆ itemId()

qint64 Item::itemId ( ) const

Definition at line 567 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 423 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 477 of file item.cpp.

◆ parent()

Item * Item::parent ( ) const

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 437 of file item.cpp.

◆ parentCollectionId()

qint64 Item::parentCollectionId ( ) const

Definition at line 577 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 590 of file item.cpp.

◆ receiver()

const QString & Item::receiver ( ) const

Returns the receiver associated to this item.

Definition at line 502 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 324 of file item.cpp.

◆ sender()

const QString & Item::sender ( ) const

Returns the sender associated to this item.

Definition at line 487 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 517 of file item.cpp.

◆ setDate()

void Item::setDate ( time_t date)

Sets the date of this item.

Definition at line 472 of file item.cpp.

◆ setFolder()

void Item::setFolder ( const QString & folder)

Sets the folder associated to this Item.

Definition at line 547 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 220 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 353 of file item.cpp.

◆ setItemId()

void Item::setItemId ( qint64 id)

Definition at line 562 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 482 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 442 of file item.cpp.

◆ setParentCollectionId()

void Item::setParentCollectionId ( qint64 id)

Definition at line 572 of file item.cpp.

◆ setReceiver()

void Item::setReceiver ( const QString & receiver)

Sets the sender associated to this item.

Definition at line 507 of file item.cpp.

◆ setSender()

void Item::setSender ( const QString & sender)

Sets the sender associated to this item.

Definition at line 492 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 462 of file item.cpp.

◆ setStatus()

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

Sets the status associated to this Item.

Definition at line 452 of file item.cpp.

◆ setSubject()

void Item::setSubject ( const QString & subject)

Sets the subject associated to this Item.

Definition at line 537 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 582 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 368 of file item.cpp.

◆ size()

size_t Item::size ( ) const

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

Definition at line 457 of file item.cpp.

◆ status()

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

Returns the status associated to this Item.

Definition at line 447 of file item.cpp.

◆ statusDescription()

QString Item::statusDescription ( ) const

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

Definition at line 248 of file item.cpp.

◆ subject()

const QString & Item::subject ( ) const

Returns the subject associated to this Item.

Definition at line 532 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 638 of file item.cpp.

◆ topmostNonRoot()

Item * Item::topmostNonRoot ( )

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

Definition at line 225 of file item.cpp.

◆ type()

Item::Type Item::type ( ) const

Returns the type of this item.

The Type can be set only in the constructor.

Definition at line 343 of file item.cpp.

◆ useReceiver()

bool Item::useReceiver ( ) const

Returns whether sender or receiver is supposed to be displayed.

Definition at line 527 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 Tue Mar 26 2024 11:12:44 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.